1 |
{ RCSid $Id$ } |
2 |
{ |
3 |
Uses gensurf to compute CRT geometry based on spherical assumption. |
4 |
|
5 |
Author: |
6 |
Greg Ward 11/13/95 |
7 |
|
8 |
Input: |
9 |
w: screen width (total) |
10 |
h: screen height (total) |
11 |
d: displacement from center tangent at max. right or left |
12 |
|
13 |
Usage: |
14 |
gensurf mat name 'x(s,t)' 'y(s,t)' 'z(s,t)' N M -s \ |
15 |
-e 'w:{width};h:{height};d:{depth}' -f screen.cal |
16 |
|
17 |
Output is oriented vertically, with the lower left corner at |
18 |
(x,y,z)=(0,0,0), the lower right at (w,0,0), the upper right |
19 |
at (w,0,h), and the screen bulge in the negative y direction. |
20 |
Surface normals face negative y, also. |
21 |
} |
22 |
{ compute sphere radius } |
23 |
r : d/2 + w*w/8/d; |
24 |
{ compute x and z } |
25 |
x(s,t) = w*s; |
26 |
z(s,t) = h*t; |
27 |
|
28 |
sq(x) : x*x; |
29 |
{ compute maximum depth (y) value } |
30 |
dmax : sqrt(r*r - sq(w/2) - sq(h/2)); |
31 |
{ compute y } |
32 |
y(s,t) = dmax - sqrt(r*r - sq(w*s-w/2) - sq(h*t-h/2)); |