1 |
{ |
2 |
Generate rays for a parabolic view projection -- |
3 |
i.e., a round image that when projected downwards |
4 |
in parallel onto a parabolic reflector results in |
5 |
a panoramic view from the paraboloid's focal point. |
6 |
|
7 |
The forward view direction corresponding to the top |
8 |
of the image is always +Y, and the up direction is |
9 |
always +Z. |
10 |
|
11 |
9/8/98 Greg Ward Larson |
12 |
|
13 |
Inputs: |
14 |
maxalt : Maximum altitude (in degrees) |
15 |
x, y = Image position, (0,0)->(1,0) is LL->LR |
16 |
|
17 |
Outputs: |
18 |
dx, dy, dz = Direction vector for image point (x,y) |
19 |
|
20 |
Typical command line: |
21 |
cnt 1024 1024 | rcalc -e maxalt:25 \ |
22 |
-e 'x=($2+.5)/1024;y=1-($1+.5)/1024' -f vwparab.cal \ |
23 |
-e '$1=25.5;$2=12;$3=5;$4=dx;$5=dy;$6=dz' \ |
24 |
| rtrace @electric.opt -fac -x 1024 -y 1024 \ |
25 |
electric.oct > pan.pic |
26 |
} |
27 |
amax : PI/180*maxalt; |
28 |
F0 : .5/cos(amax) - .5*tan(amax); { dist. btwn. parabola and directrix } |
29 |
xr = 2*x - 1; |
30 |
yr = 2*y - 1; |
31 |
r2 = xr*xr + yr*yr; |
32 |
r = sqrt(r2); { never actually needed } |
33 |
z = r2/(4*F0) + F0; |
34 |
zo = r2/(4*F0) - F0; |
35 |
sin_alt = zo/z; |
36 |
cos_alt = r/z; |
37 |
dx = xr/z; { same as xr/r*cos_alt } |
38 |
dy = yr/z; { same as yr/r*cos_alt } |
39 |
dz = zo/z; { same as sin_alt } |