Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- from math import radians, degrees, cos, sin
- from IPython.core import display
- from io import BytesIO
- midx, midy = 361, 361
- img = Image.new( 'RGB', (722,722), "white") # create a new white image
- pixels = img.load() # create the pixel map
- class cart:
- def __init__(self, m, x, y, z):
- self.m = zeros(m, dtype = int16)
- self.x = zeros(x, dtype = int16)
- self.y = zeros(y, dtype = int16)
- self.z = zeros(z, dtype = int16)
- maps = array([cart((720, 720), 720, 720, 720) for x in range(720)])
- dir = '.'
- for q in range(1,721):
- for s in range(361):
- for t in range(1,361):
- #print(s,t,q)
- maps[q].x[t] = (cos(radians(s)) * t) + midx
- maps[q].y[t] = (sin(radians(t)) * s) + midy
- maps[q].z[t] = s
- x = maps[q].x[t] - midx
- z = maps[q].z[t]
- x = round(cos(radians(q/2)) * x - sin(radians(q/2)) * z)
- maps[q].x[t] = x + midx
- pixels[abs(int(maps[q].x[t])), abs(int(maps[q].y[t]))] = (int(maps[q].x[t]), int(maps[q].y[t]), 100)
- print(q)
- img = img.rotate(180)
- img.save(dir+'/image'+str(q)+'.png', 'png')
- img = Image.new( 'RGB', (722,722), "white")
- pixels = img.load()
Advertisement
Add Comment
Please, Sign In to add comment