TubeDefs.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Bloomenthal, February 24, 1987 6:14:49 pm PST
DIRECTORY Contours, Controls, Controls3d, Draw2d, Imager, IO, Matrix3d, Render3d, Rope, Spline3d, ThreeDBasics, Vector3d;
TubeDefs: CEDAR DEFINITIONS
~ BEGIN
Nomenclature
A tube is a tree-like structure that may have an antecedent (tube.prev), a continuation (tube.next), and an arbitrary number of branches (tube.branches). A section is a tube considered by itself, without its continuation or branches. A branch is a tube and, recursively, its continuation. Generally, a tube means the sub-tree consisting of the current section and, recursively, its continuation and branches. The entire tree is the sub-tree that has no antecedent.
Tube Definitions
Tube: TYPE ~ REF TubeRep;
TubeRep:
TYPE ~
RECORD [
geometric givens:
p0, p1: Triple ← origin, -- Hermite endpoints of curve
v0, v1: Triple ← origin, -- Hermite tangents of curve
tw0, tw1: REAL ← 0.0, -- twists
tens0, tens1: REAL ← 1.0, -- tensions
r0, r1: REAL ← 0.05, -- radii
contours: ContourSequence ← NIL, -- optional contours
geometric derivations:
coeffs: Coeffs ← NIL, -- coefficients of curve
xCoeffs: Coeffs ← NIL, -- curve xformed to screen
refVec: Triple ← origin, -- reference vector to make frames
circleRes: INTEGER ← 6, -- # sides of circular contour
length: REAL ← 0.0, -- length of the tube
length0, length1: REAL ← 0.0, -- distances from root
frames: FrameSequence ← NIL, -- reference frames, ordered by t
topology:
prev, next: Tube ← NIL, -- parent and continuing tubes
branches: TubeSequence ← NIL, -- branch (non-continuing) tubes
nearness:
near3d: Near3d ← [origin, 0.0, 0.0], -- relative to a previous query
miscellaneous:
name: ROPE ← NIL, -- optional name of tube
refAny: REF ANY ← NIL, -- for client data
selected: BOOL ← FALSE -- selected for drawing?
];
TubeSequence: TYPE ~ REF TubeSequenceRep;
TubeSequenceRep:
TYPE ~
RECORD [
length: NAT ← 0,
element: SEQUENCE maxLength: NAT OF Tube
];
Pendings: TYPE ~ REF PendingsRep;
PendingsRep:
TYPE ~
RECORD [
epsilon: BOOL ← FALSE,
scale: BOOL ← FALSE,
r: BOOL ← FALSE,
tens: BOOL ← FALSE,
tw0: BOOL ← FALSE,
tw1: BOOL ← FALSE,
cres: BOOL ← FALSE,
holdPosition: BOOL ← FALSE,
holdTangent: BOOL ← FALSE,
shape: BOOL ← FALSE,
skin: BOOL ← FALSE
];
DetailType:
TYPE ~ {autoSimplify, label, skeleton, spline, ends, pick,
enabled, frames, lines, curvature, velocity,
acceleration, contours, normals, shape, skin};
Details: TYPE ~ REF DetailsRep;
DetailsRep:
TYPE ~
RECORD [
autoSimplify: BOOL ← FALSE, -- kill details if mouse held
label: BOOL ← TRUE, -- label vectors
skeleton: BOOL ← FALSE, -- draw straight line skeleton
spline: BOOL ← TRUE, -- draw spline axis
ends: BOOL ← TRUE, -- draw spline ends
pick: BOOL ← TRUE, -- draw picked point
enabled: BOOL ← TRUE, -- enable viewing of details
frames: BOOL ← FALSE, -- reference frames
lines: BOOL ← FALSE, -- longitudinal lines
curvature: BOOL ← FALSE, -- curvature
velocity: BOOL ← FALSE, -- velocity
acceleration: BOOL ← FALSE, -- acceleration
contours: BOOL ← FALSE, -- contours (default to circles)
normals: BOOL ← FALSE, -- normals
shape: BOOL ← FALSE, -- frames or curv or vel or acc
skin: BOOL ← FALSE -- contours or normals:
];
Pick: TYPE ~ REF PickRep;
PickRep:
TYPE ~
RECORD [
origPos: Triple ← [0.0, 0.0, 0.0],
pos, tan: Triple ← [0.0, 0.0, 0.0],
t: REAL ← 1.0,
tube: Tube ← NIL,
selected0, selected1: Tube ← NIL,
dividePending: BOOL ← FALSE
];
CallBack Procedure Definitions
TubeProc:
TYPE ~
PROC [tube: Tube]
RETURNS [continue:
BOOL ←
TRUE];
Procedure for operating on each tube section.
FrameProc:
TYPE ~
PROC [position, velocity: Triple, t:
REAL]
RETURNS [Frame];
Return a frame given the position and velocity
of the curve at parametric position t.
PointProc:
TYPE ~
PROC [id:
INTEGER, position, normal: Triple, u, v:
REAL]
RETURNS [continue: BOOL ← TRUE];
Procedure for operating on the given point.
PolyProc:
TYPE ~
PROC [id, p0, p1, p2:
INTEGER]
RETURNS [continue:
BOOL ←
TRUE];
Procedure for operating on the given triangle.
Geometric Definitions
Near2d: TYPE ~ Spline3d.Near2d;
Near3d: TYPE ~ Spline3d.Near3d;
Hull: TYPE ~ RECORD [center, pMin, pMax: Triple, rMin, rMax: REAL];
Triad: TYPE ~ RECORD [v, n, b: Triple]; -- vector, principal normal, binormal
see Computational Geometry for Design and Manufacture
RadiusMode: TYPE ~ {linear, square};
Contour: TYPE ~ Contours.Contour;
ContourSequence: TYPE ~ Contours.ContourSequence; -- presumed ordered according to t
Frame: TYPE ~ REF FrameRep;
FrameRep:
TYPE ~
RECORD [
t: REAL ← 0.0, -- parametric position on curve
position: Triple ← origin, -- position on curve
triad: Triad ← [origin,origin,origin], -- triad with no scale or twist
scale: REAL ← 1.0, -- scale
twist: REAL ← 0.0, -- twist
matrix: Matrix ← NIL, -- matrix including scale, twist
contour: Contour ← NIL, -- normalized to unit square
normals: PairSequence ← NIL -- normals of contour
];
FrameSequence: TYPE ~ REF FrameSequenceRep;
FrameSequenceRep:
TYPE ~
RECORD [
length: NAT ← 0,
element: SEQUENCE maxLength: NAT OF Frame
];
Types
ROPE: TYPE ~ Rope.ROPE;
STREAM: TYPE ~ IO.STREAM;
Context: TYPE ~ Imager.Context;
MarkType: TYPE ~ Draw2d.MarkType;
Viewer: TYPE ~ Controls.Viewer;
Control: TYPE ~ Controls.Control;
GraphicsData: TYPE ~ Controls.GraphicsData;
OuterData: TYPE ~ Controls.OuterData;
Mouse: TYPE ~ Controls.Mouse;
ClickProc: TYPE ~ Controls.ClickProc;
ControlList: TYPE ~ Controls.ControlList;
ButtonList: TYPE ~ Controls.ButtonList;
Camera: TYPE ~ Controls3d.Camera;
Hold: TYPE ~ Controls3d.Hold;
RenderStyle: TYPE ~ Render3d.RenderStyle;
Context3d: TYPE ~ REF ThreeDBasics.Context;
RealSequence: TYPE ~ Vector3d.RealSequence;
Pair: TYPE ~ Vector3d.Pair;
PairSequence: TYPE ~ Vector3d.PairSequence;
PairSequenceRep: TYPE ~ Vector3d.PairSequenceRep;
Triple: TYPE ~ Vector3d.Triple;
TripleSequence: TYPE ~ Vector3d.TripleSequence;
TripleSequenceRep: TYPE ~ Vector3d.TripleSequenceRep;
Bezier: TYPE ~ Spline3d.Bezier;
Coeffs: TYPE ~ Spline3d.Coeffs;
CoeffsRep: TYPE ~ Spline3d.CoeffsRep;
CoeffsSequence: TYPE ~ Spline3d.CoeffsSequence;
Matrix: TYPE ~ Matrix3d.Matrix;
MatrixRep: TYPE ~ Matrix3d.MatrixRep;
MatrixSequence: TYPE ~ Matrix3d.MatrixSequence;
MatrixSequenceRep: TYPE ~ Matrix3d.MatrixSequenceRep;
Constants
origin: Triple ~ Vector3d.origin;
xAxis: Triple ~ Vector3d.xAxis;
yAxis: Triple ~ Vector3d.yAxis;
zAxis: Triple ~ Vector3d.zAxis;
PI: REAL ~ 3.1415926535;
END.