here2share

# tk_Superellipsoid.py

May 8th, 2026
106
0
Never
5
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.54 KB | None | 0 0
  1. # tk_Superellipsoid.py
  2.  
  3. import tkinter as tk
  4. import math
  5. import random
  6. import array
  7. import struct
  8.  
  9. WIDTH, HEIGHT = 600, 600
  10. LINEWIDTH = 2
  11. FOV = 700.0
  12. SCALE = 220.0
  13.  
  14. U_STEPS = 44
  15. V_STEPS = 22
  16. EPS1 = 0.65
  17. EPS2 = 0.65
  18.  
  19. ANGLE_STEPS = 1440
  20. _step = 2 * math.pi / ANGLE_STEPS
  21. x_cache = [(math.cos(i * _step), math.sin(i * _step)) for i in range(ANGLE_STEPS)]
  22. y_cache = x_cache
  23. z_cache = x_cache
  24.  
  25. def sgn(x):
  26.     return 1.0 if x >= 0 else -1.0
  27.  
  28. def spow(v, p):
  29.     return sgn(v) * (abs(v) ** p)
  30.  
  31. def superellipsoid_point(u, v, e1=EPS1, e2=EPS2):
  32.     cu, su = math.cos(u), math.sin(u)
  33.     cv, sv = math.cos(v), math.sin(v)
  34.     x = spow(cv, e1) * spow(cu, e2)
  35.     y = spow(cv, e1) * spow(su, e2)
  36.     z = spow(sv, e1)
  37.     return x, y, z
  38.  
  39. def orange_depth(d):
  40.     t = max(0.0, min(1.0, d))
  41.     r = int(70 + 185 * t)
  42.     g = int(25 + 120 * t)
  43.     b = int(0 + 30 * t)
  44.     return f'#{r:02x}{g:02x}{b:02x}'
  45.  
  46. color_cache = [orange_depth(i / 255) for i in range(256)]
  47.  
  48. root = tk.Tk()
  49. root.title("Superellipsoid")
  50. root.geometry("+-5+0")
  51. root.resizable(False, False)
  52. canvas = tk.Canvas(root, width=WIDTH, height=HEIGHT, bg="black", highlightthickness=0)
  53. canvas.pack()
  54.  
  55. W2 = WIDTH * 0.5
  56. H2 = HEIGHT * 0.5
  57.  
  58. verts = []
  59. for iv in range(V_STEPS + 1):
  60.     v = -math.pi / 2 + math.pi * iv / V_STEPS
  61.     for iu in range(U_STEPS):
  62.         u = 2 * math.pi * iu / U_STEPS
  63.         verts.append(superellipsoid_point(u, v))
  64.  
  65. VCOUNT = len(verts)
  66. raw = array.array('d')
  67. for x, y, z in verts:
  68.     raw.extend((x, y, z))
  69. RAW_FMT = f'{VCOUNT * 3}d'
  70.  
  71. edges = set()
  72. for iv in range(V_STEPS + 1):
  73.     for iu in range(U_STEPS):
  74.         a = iv * U_STEPS + iu
  75.         b = iv * U_STEPS + ((iu + 1) % U_STEPS)
  76.         edges.add(tuple(sorted((a, b))))
  77.         if iv < V_STEPS:
  78.             c = (iv + 1) * U_STEPS + iu
  79.             edges.add(tuple(sorted((a, c))))
  80. edges = sorted(edges)
  81.  
  82. ECOUNT = len(edges)
  83.  
  84. _px = array.array('d', bytes(VCOUNT * 8))
  85. _py = array.array('d', bytes(VCOUNT * 8))
  86. _dep = array.array('B', bytes(VCOUNT))
  87.  
  88. lines = [
  89.     canvas.create_line(0, 0, 1, 1, fill=color_cache[128], width=LINEWIDTH, capstyle=tk.ROUND)
  90.     for _ in range(ECOUNT)
  91. ]
  92.  
  93. ix = random.randrange(ANGLE_STEPS)
  94. iy = random.randrange(ANGLE_STEPS)
  95. iz = random.randrange(ANGLE_STEPS)
  96.  
  97. _coords = canvas.coords
  98. _config = canvas.itemconfig
  99. _after = root.after
  100. _unpack = struct.unpack
  101. _randint = random.randint
  102.  
  103. def rotate():
  104.     return _randint(8, 20)
  105.  
  106. def draw_frame():
  107.     global ix, iy, iz
  108.     ix = (ix + rotate()) % ANGLE_STEPS
  109.     iy = (iy + rotate()) % ANGLE_STEPS
  110.     iz = (iz + rotate()) % ANGLE_STEPS
  111.  
  112.     cx, sx = x_cache[ix]
  113.     cy, sy = y_cache[iy]
  114.     cz, sz = z_cache[iz]
  115.  
  116.     m00 = cy*cz;            m01 = cz*sx*sy - cx*sz;  m02 = cx*cz*sy + sx*sz
  117.     m10 = cy*sz;            m11 = cx*cz + sx*sy*sz;  m12 = cx*sy*sz - cz*sx
  118.     m20 = -sy;              m21 = cy*sx;              m22 = cx*cy
  119.  
  120.     pts = _unpack(RAW_FMT, raw)
  121.  
  122.     for i in range(VCOUNT):
  123.         j = i * 3
  124.         x = pts[j]; y = pts[j + 1]; z = pts[j + 2]
  125.         rx = m00*x + m01*y + m02*z
  126.         ry = m10*x + m11*y + m12*z
  127.         rz = m20*x + m21*y + m22*z
  128.         f = FOV / (rz + FOV) * SCALE
  129.         _px[i] = rx * f + W2
  130.         _py[i] = -ry * f + H2
  131.         d = int((rz + 1.7) * 75.0)
  132.         _dep[i] = 255 if d > 255 else (0 if d < 0 else d)
  133.  
  134.     for i, (a, b) in enumerate(edges):
  135.         _coords(lines[i], _px[a], _py[a], _px[b], _py[b])
  136.         _config(lines[i], fill=color_cache[(_dep[a] + _dep[b]) >> 1])
  137.  
  138.     _after(1, draw_frame)
  139.  
  140. draw_frame()
  141. root.mainloop()
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Abnalib
    14 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment