G3dPatch.mesa
Copyright Ó 1985, 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, October 21, 1992 4:59 pm PDT
DIRECTORY G3dBasic, G3dMatrix, G3dSpline;
G3dPatch: CEDAR DEFINITIONS
~ BEGIN
Type Declarations
Triple:    TYPE ~ G3dBasic.Triple;
Matrix:    TYPE ~ G3dMatrix.Matrix;
Spline:    TYPE ~ G3dSpline.Spline;
MinMax:    TYPE ~ RECORD [min, max: REAL];
ControlPoints:  TYPE ~ REF ControlPointsRep;
ControlPointsRep: TYPE ~ ARRAY [0..4) OF ARRAY [0..4) OF Triple;
        Four sets in the t direction of four points in the s direction.
Patch:     TYPE ~ REF PatchRep;
PatchRep:    TYPE ~ RECORD [
controlPoints:    ControlPoints ¬ NIL,
sCurves:      ARRAY [0..4) OF Spline ¬ ALL[NIL],
tCurves:      ARRAY [0..4) OF Spline ¬ ALL[NIL]
];
FourPatches:   TYPE ~ ARRAY [0..4) OF Patch;
Creation
FromBezier: PROC [cp: ControlPoints, out: Patch ¬ NIL] RETURNS [Patch];
Create a representation for the Bezier curved surface,
given a sequence of 16 control points. Use out if non-NIL.
Evaluation
Position: PROC [patch: Patch, s, t: REAL] RETURNS [Triple];
Return the point of the surface at parametric coordinates (s, t).
Normal: PROC [patch: Patch, s, t: REAL, unitize: BOOL ¬ TRUE] RETURNS [Triple];
Return the normal of the surface at parametric coordinates (s, t).
MinMaxCurvature: PROC [patch: Patch, s, t: REAL] RETURNS [MinMax];
Return the minimum and maximum curvatures at parametric coordinates (s, t).
SCurve: PROC [patch: Patch, s: REAL, out: Spline ¬ NIL] RETURNS [Spline];
Return the curve with constant s, evaluated t IN [0..1].
TCurve: PROC [patch: Patch, t: REAL, out: Spline ¬ NIL] RETURNS [Spline];
Return the curve with constant t, evaluated s IN [0..1].
Subdivision
Subdivide: PROC [patch: Patch, s, t: REAL ¬ 0.5] RETURNS [FourPatches];
Return the four patches: [0..s][0..t] (p0), [s..1][0..t] (p1), [0..s][t..1] (p2), and [s..1][t..1] (p3).
END.