| 1 | 
.\" RCSid "$Id: gensurf.1,v 1.9 2025/01/21 01:56:27 greg Exp $" | 
| 2 | 
.TH GENSURF 1 11/15/93 RADIANCE | 
| 3 | 
.SH NAME | 
| 4 | 
gensurf - generate a RADIANCE or Wavefront description of a curved surface | 
| 5 | 
.SH SYNOPSIS | 
| 6 | 
.B "gensurf mat name 'x(s,t)' 'y(s,t)' 'z(s,t)' m n" | 
| 7 | 
[ | 
| 8 | 
.B "\-e expr" | 
| 9 | 
][ | 
| 10 | 
.B "\-f file" | 
| 11 | 
][ | 
| 12 | 
.B \-s | 
| 13 | 
][ | 
| 14 | 
.B \-i | 
| 15 | 
][ | 
| 16 | 
.B \-o | 
| 17 | 
] | 
| 18 | 
.br | 
| 19 | 
.B "gensurf mat name 'x(s,t)' 'y(s,t)' dfile m n" | 
| 20 | 
[ | 
| 21 | 
.B "\-e expr" | 
| 22 | 
][ | 
| 23 | 
.B "\-f file" | 
| 24 | 
][ | 
| 25 | 
.B \-i | 
| 26 | 
][ | 
| 27 | 
.B \-s | 
| 28 | 
][ | 
| 29 | 
.B \-o | 
| 30 | 
] | 
| 31 | 
.br | 
| 32 | 
.B "gensurf mat name dfile dfile dfile m n" | 
| 33 | 
[ | 
| 34 | 
.B \-i | 
| 35 | 
][ | 
| 36 | 
.B \-s | 
| 37 | 
][ | 
| 38 | 
.B \-o | 
| 39 | 
] | 
| 40 | 
.SH DESCRIPTION | 
| 41 | 
.I Gensurf | 
| 42 | 
produces either a RADIANCE scene description or a Wavefront .OBJ | 
| 43 | 
file of a functional surface defined by the parametric equations | 
| 44 | 
.I x(s,t), | 
| 45 | 
.I y(s,t), | 
| 46 | 
and | 
| 47 | 
.I z(s,t). | 
| 48 | 
The surface normal is defined by the right hand rule as | 
| 49 | 
applied to | 
| 50 | 
.I (s,t). | 
| 51 | 
.I S | 
| 52 | 
will vary from 0 to 1 in steps of | 
| 53 | 
.I 1/m, | 
| 54 | 
and | 
| 55 | 
.I t | 
| 56 | 
will vary from 0 to 1 in steps of | 
| 57 | 
.I 1/n. | 
| 58 | 
The surface will be composed of | 
| 59 | 
.I 2*m*n | 
| 60 | 
or fewer triangles and quadrilaterals. | 
| 61 | 
The expressions are of the same type used in RADIANCE | 
| 62 | 
function files. | 
| 63 | 
Auxiliary expressions and/or files may be specified | 
| 64 | 
in any number of | 
| 65 | 
.I \-e | 
| 66 | 
and | 
| 67 | 
.I \-f | 
| 68 | 
options. | 
| 69 | 
The variable and function definitions in each | 
| 70 | 
.I \-f source | 
| 71 | 
file are read and compiled from the RADIANCE library where it is found. | 
| 72 | 
The | 
| 73 | 
.I \-i | 
| 74 | 
option reverses surface normal directions relative to the (s,t) parameters, applying | 
| 75 | 
a left-hand rule, instead. | 
| 76 | 
The | 
| 77 | 
.I \-s | 
| 78 | 
option adds smoothing (surface normal interpolation) to the surface. | 
| 79 | 
The | 
| 80 | 
.I \-o | 
| 81 | 
option produces a Wavefront .OBJ file rather than a RADIANCE | 
| 82 | 
scene description. | 
| 83 | 
This is most useful as input to the | 
| 84 | 
.I obj2mesh(1) | 
| 85 | 
program for producing a compiled mesh. | 
| 86 | 
A single "usemtl" statement will appear at the beginning | 
| 87 | 
of the .OBJ output, echoing the modifier given on the command line. | 
| 88 | 
.PP | 
| 89 | 
Rough holes may be cut in the mesh by defining a valid(s,t) function. | 
| 90 | 
Where this function is positive, polygon vertices will be produced. | 
| 91 | 
Where it is negative, no geometry will be output. | 
| 92 | 
Surface normal interpolation will ignore any invalid vertices. | 
| 93 | 
.PP | 
| 94 | 
The second invocation form reads z data values from the file | 
| 95 | 
.I dfile. | 
| 96 | 
This file must give either m*n or (m+1)*(n+1) floating point z | 
| 97 | 
values. | 
| 98 | 
If m*n values are given, then the values correspond to the centroid | 
| 99 | 
of each quadrilateral region. | 
| 100 | 
If (m+1)*(n+1) values are given, then the values correspond to the | 
| 101 | 
vertices of each quadrilateral region. | 
| 102 | 
The ordering of the data in the file is such that the s values are | 
| 103 | 
changing faster than the t values. | 
| 104 | 
If a minus ('-') is given for | 
| 105 | 
.I dfile, | 
| 106 | 
then the values are read from the standard input. | 
| 107 | 
.PP | 
| 108 | 
The third invocation form is used to read coordinate triplets from a | 
| 109 | 
file or the standard input. | 
| 110 | 
The three | 
| 111 | 
.I dfile | 
| 112 | 
arguments must all be the same, and the corresponding file must | 
| 113 | 
contain three floating point values for each point location. | 
| 114 | 
The ordering and other details are the same as those described | 
| 115 | 
for z value files above. | 
| 116 | 
.SH EXAMPLE | 
| 117 | 
To generate a tesselated sphere: | 
| 118 | 
.IP "" .2i | 
| 119 | 
gensurf crystal ball 'sin(PI*s)*cos(2*PI*t)' 'cos(PI*s)' 'sin(PI*s)*sin(2*PI*t)' 7 10 | 
| 120 | 
.PP | 
| 121 | 
To generate a 10x20 smoothed height field from 12 recorded vertex | 
| 122 | 
z values: | 
| 123 | 
.IP "" .2i | 
| 124 | 
gensurf dirt ground '10*s' '20*t' height.dat 2 3 \-s | 
| 125 | 
.SH ENVIRONMENT | 
| 126 | 
RAYPATH         the directories to check for auxiliary files. | 
| 127 | 
.SH AUTHOR | 
| 128 | 
Greg Ward | 
| 129 | 
.SH BUGS | 
| 130 | 
The smoothing operation requires that functions be defined | 
| 131 | 
beyond the [0,1] boundaries of s and t. | 
| 132 | 
.SH "SEE ALSO" | 
| 133 | 
genbox(1), genrev(1), genworm(1), icalc(1), | 
| 134 | 
obj2mesh(1), obj2rad(1), robjutil(1), rpict(1), rvu(1), xform(1) |