G3dSweep.mesa
Copyright Ó 1984, 1992 by Xerox Corporation. All rights reserved.
Glassner, September 21, 1989 12:28:24 pm PDT
Bloomenthal, July 15, 1992 4:06 pm PDT
DIRECTORY G3dBasic, G3dMatrix, G3dQuaternion, G3dShape, G3dTube, IO, Rope;
G3dSweep: CEDAR DEFINITIONS
~ BEGIN
Basic Types
Triple:     TYPE ~ G3dBasic.Triple;
TripleSequence:   TYPE ~ G3dBasic.TripleSequence;
Shape:     TYPE ~ G3dShape.Shape;
Matrix:     TYPE ~ G3dMatrix.Matrix;
AxisAngle:    TYPE ~ G3dQuaternion.AxisAngle;
ROPE:      TYPE ~ Rope.ROPE;
STREAM:     TYPE ~ IO.STREAM;
Tube:      TYPE ~ G3dTube.Tube;
Quaternion:    TYPE ~ G3dQuaternion.Quaternion; 
Local Types
SurfaceDescription:  TYPE ~ REF SurfaceDescriptionRep;
SurfaceDescriptionRep: TYPE ~ RECORD [
open:        BOOL ¬ FALSE
];
SweepPaths:    TYPE ~ REF SweepPathsRep;
SweepPathsRep:   TYPE ~ RECORD [
shapeFile:      ROPE ¬ NIL,
shapeBlend:      BlendType ¬ smooth,
scaleFile:       ROPE ¬ NIL,
scaleBlend:      BlendType ¬ smooth,
rotateFile:      ROPE ¬ NIL,
rotateBlend:      BlendType ¬ smooth,
translateFile:      ROPE ¬ NIL,
translateBlend:     BlendType ¬ smooth,
pathFile:       ROPE ¬ NIL,
pathBlend:      BlendType ¬ smooth
];
BlendType:   TYPE ~ {straight, smooth, cyclic};
SubdivisionType: TYPE ~ {none, halfTriangulate, quarterTriangulate};
FileType:    TYPE ~ {shape, path, scale, rotate, translate};
ShapeBlendProc: TYPE ~ PROC [
t:      REAL,
blend:    BlendType ¬ smooth,
clientData:  REF ANY ¬ NIL
] RETURNS [Shape];
PathProc:   TYPE ~ PROC [
t:      REAL,
blend:    BlendType ¬ smooth,
clientData:  REF ANY ¬ NIL
] RETURNS [Matrix];
ScaleProc:   TYPE ~ PROC [
t:     REAL,
blend:    BlendType ¬ smooth,
clientData:   REF ANY ¬ NIL
] RETURNS [Triple];
RotateProc:  TYPE ~ PROC [
t:      REAL,
blend:    BlendType ¬ smooth,
clientData:  REF ANY ¬ NIL
] RETURNS [AxisAngle];
TranslateProc: TYPE ~ PROC [
t:      REAL,
blend:    BlendType ¬ smooth,
clientData:  REF ANY ¬ NIL
] RETURNS [Triple];
XformProc:  TYPE ~ PROC [
t:      REAL,
blend:    BlendType ¬ smooth,
clientData:  REF ANY ¬ NIL
] RETURNS [Matrix];
KeyData:     TYPE ~ REF KeyDataRep;
KeyDataRep:    TYPE ~ RECORD [
alpha:       REAL ¬ -1.0,
rope:       ROPE ¬ NIL,
real:       REAL ¬ 0.0,
triple:       Triple ¬ [0.0, 0.0, 0.0],
quaternion:     Quaternion,
next, prev:     KeyData ¬ NIL
];
KeyList:     TYPE ~ REF KeyListRep;
KeyListRep:    TYPE ~ RECORD [
type:       BlendType ¬ smooth,
tube:       Tube,
knots:       TripleSequence,
keys:       KeyData
];
Constants
pi: REAL = 3.141593;
piOver2: REAL = 1.570796;
piTimes2: REAL = 6.283186;
degreesToRadians: REAL = .01745329;
radiansToDegrees: REAL = 57.29577;
Impl Procs
Support for KeyLists From Files and Streams
KeyListFromFile: PUBLIC PROC [filename: ROPE, type: FileType, b: BlendType] RETURNS [KeyList];
KeyListFromStream: PUBLIC PROC [stream: STREAM, type: FileType, b: BlendType] RETURNS [KeyList];
Shape Blending And Combining Procedures
Merge2Shapes: PUBLIC PROC [s1, s2: Shape, addPolys: BOOL ¬ TRUE] RETURNS [s: Shape];
Polygon To Shape Utility Procedures
AddTriangleToShape: PUBLIC PROC [shape: Shape, v0, v1, v2: INT];
AddGeneralQuadrilateralToShape: PUBLIC PROC [
shape: Shape,
v0, v1, v2, v3: INT,
op: SubdivisionType ¬ none
];
Simple Sweep Setup Procedures
SimpleSetupShapeBlendProc: PUBLIC PROC [lo, hi: ROPE] RETURNS [REF ANY];
SimpleSetupRotateProc: PUBLIC PROC [lo, hi: AxisAngle] RETURNS [REF ANY];
SimpleSetupPathProc: PUBLIC PROC [lo, hi: Triple] RETURNS [REF ANY];
SimpleSetupScaleProc: PUBLIC PROC [lo, hi: Triple] RETURNS [REF ANY];
SimpleSetupTranslateProc: PUBLIC PROC [lo, hi: Triple] RETURNS [REF ANY];
Sweep Default Setup Procedures
SetupDefaultShapeBlendProc: PUBLIC PROC [f: ROPE, b: BlendType] RETURNS [REF ANY];
SetupDefaultPathProc: PUBLIC PROC [f: ROPE, b: BlendType] RETURNS [REF ANY];
SetupDefaultScaleProc: PUBLIC PROC [f: ROPE, b: BlendType] RETURNS [REF ANY];
SetupDefaultRotateProc: PUBLIC PROC [f: ROPE, b: BlendType] RETURNS [REF ANY];
SetupDefaultTranslateProc: PUBLIC PROC [f: ROPE, b: BlendType] RETURNS [REF ANY];
Sweep Default Evaluation Procedures
DefaultShapeBlendProc: PUBLIC ShapeBlendProc;
DefaultPathProc: PUBLIC PathProc;
DefaultScaleProc: PUBLIC ScaleProc;
DefaultRotateProc: PUBLIC RotateProc;
DefaultTranslateProc: PUBLIC TranslateProc;
Sweep Construction
MakeSweepShape: PUBLIC PROC [
shapeProc: ShapeBlendProc,
shapeData: REF ANY ¬ NIL,
shapeBlend: BlendType ¬ smooth,
pathProc: PathProc ¬ NIL,
pathData: REF ANY ¬ NIL,
pathBlend: BlendType ¬ smooth,
scaleProc: ScaleProc ¬ NIL,
scaleData: REF ANY ¬ NIL,
scaleBlend: BlendType ¬ smooth,
rotateProc: RotateProc ¬ NIL,
rotateData: REF ANY ¬ NIL,
rotateBlend: BlendType ¬ smooth,
translateProc: TranslateProc ¬ NIL,
translateData: REF ANY ¬ NIL,
translateBlend: BlendType ¬ smooth,
xformProc: XformProc ¬ NIL,
xformData: REF ANY ¬ NIL,
xformBlend: BlendType ¬ smooth,
steps: INT ¬ 10,
tLo: REAL ¬ 0.0,
tHi: REAL ¬ 1.0,
firstInstance: BOOL ¬ FALSE,
lastInstance: BOOL ¬ FALSE,
reverseFirstInstance: BOOL ¬ FALSE,
reverseLastInstance: BOOL ¬ TRUE,
anchor: BOOL ¬ FALSE,
instance: BOOL ¬ TRUE,
connect: BOOL ¬ TRUE,
localXSections: BOOL ¬ FALSE,
tubeTexture: BOOL ¬ TRUE,
close: BOOL ¬ FALSE
] RETURNS [Shape];
END.