27th September 2002 21:38 UTC
My lens problem
Some of you might know this from DA, but nobody actually solved the problem there, and since all you math geniuses appear to be here, I decided to post my problem here. The idea to create what you when you hold a orb-like lens above a material (the background here).
I wanted to make a physically correct lens with the formula:
sin(entry angle)
----------------- = constant
sin(output angle)
This is the formula for light going trough different translucent materials.
I created a dynmov with the following code:
init:
bi=1.3;dt=1;df=1;si=1;
frame and beat don't mather, they just change the x1 and y1 values.
pixel:
x=x*dt+sin(x1);y=y*dt+sin(y1);
l=max(si-sqrt(x*x+y*y),0);
r=atan2(y,x);
xdti=cos(r)*-l*pi/2;xdtu=asin(sin(xdti)/bi);x2=tan(xdtu)*(l*2);
ydti=sin(r)*-l*pi/2;ydtu=asin(sin(ydti)/bi);y2=tan(ydtu)*(l*2);
rx=atan2(x2,l*2);ry=atan2(y2,l*2);
xdti2=rx*l-xdtu;xdtu2=asin(sin(xdti2)/bi);
ydti2=ry*l-ydtu;ydtu2=asin(sin(ydti2)/bi);
x=x-tan(xdtu2)*(0.5-l+df)-sin(x1);
y=y-tan(ydtu2)*(0.5-l+df)-sin(y1);
Anyway the problem is that when you change either the si (size of lens) or bi (abb******on for dutch word brekingsindex, fraction index) in the init, the lens go weird.
The si-problem is seen the best: If you change it to two, it gets totally weird.
The bi-problem is more subtle: The fraction of the light passing the lens should get larger if you enlarge bi, but it gets smaller!
I hope you understand what I'm saying and if don't know what I did with a certain piece of code, you can ask. Actually, I encourage you to ask.
I also attached a preset, where an advanced version of the (bad) lens is used. It requires the convoltion ape. It''s actually a quite cool preset, it contains in text the first ten article of the Human Rights Declaration.