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