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