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