adjustments
This commit is contained in:
parent
ffb42b8b0e
commit
553fcea7e3
13
rainbow.py
13
rainbow.py
@ -15,10 +15,10 @@ center = [0,0]
|
|||||||
r = 1
|
r = 1
|
||||||
n = 1.3
|
n = 1.3
|
||||||
disk = Disk(center, r, n)
|
disk = Disk(center, r, n)
|
||||||
dx = 0.01
|
dx = 0.00001
|
||||||
N = int(2*r /dx - 1)
|
N = int(2*r /dx - 1)
|
||||||
min_intensity = 0.001
|
min_intensity = 0.00001
|
||||||
max_ray = 10000
|
max_ray = 1000000
|
||||||
|
|
||||||
stack = []
|
stack = []
|
||||||
result = []
|
result = []
|
||||||
@ -155,7 +155,7 @@ def bin_find(x, list):
|
|||||||
def take_picture(angles, angle_sRGB, w, h, distance, filename="image.png"):
|
def take_picture(angles, angle_sRGB, w, h, distance, filename="image.png"):
|
||||||
image_array = np.zeros((w, h, 3), dtype=np.uint8)
|
image_array = np.zeros((w, h, 3), dtype=np.uint8)
|
||||||
radius = distance * np.tan(angles)
|
radius = distance * np.tan(angles)
|
||||||
for i in range(w):
|
for i in track(range(w), description="generating picture..."):
|
||||||
for j in range(h):
|
for j in range(h):
|
||||||
r = np.linalg.norm(np.array([i,j]) - [w/2, 0])
|
r = np.linalg.norm(np.array([i,j]) - [w/2, 0])
|
||||||
index = bin_find(r, radius)
|
index = bin_find(r, radius)
|
||||||
@ -164,5 +164,6 @@ def take_picture(angles, angle_sRGB, w, h, distance, filename="image.png"):
|
|||||||
image.save(filename)
|
image.save(filename)
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
angles,sRGB=rainbow(10, 10)
|
angles,sRGB=rainbow(10000, 10)
|
||||||
take_picture(angles,sRGB, 1920, 1080, 500, "image.png")
|
np.savez_compressed("saved.npz", a=angles, b=sRGB)
|
||||||
|
take_picture(angles,sRGB, 3840, 2160, 1200, "image.png")
|
||||||
|
Loading…
Reference in New Issue
Block a user