add interp

This commit is contained in:
Yingjie Wang 2023-11-11 15:28:13 -05:00
parent 9d338f8927
commit 7fb4669c4b

View File

@ -16,9 +16,9 @@ center = [0,0]
r = 1
# n = 1.3
# disk = Disk(center, r, n)
N = 10000
N = 100000
min_intensity = 0.00001
max_ray = 1000000
max_ray = 100*N
stack = []
result = []
@ -197,7 +197,8 @@ def draw_column(i, w, h, radius, angle_sRGB):
for j in range(h):
r = np.linalg.norm(np.array([i,j]) - [w/2, 0])
index = bin_find(r, radius, index)
column[j] = angle_sRGB[index]*255
ratio = (r - radius[index])/(radius[index+1] - radius[index])
column[j] = ((1-ratio)*angle_sRGB[index]+ratio*angle_sRGB[index+1])*255
return i,column
def take_picture(angles, angle_sRGB, w, h, distance, filename="image.png"):