TubeStructure.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Bloomenthal, May 20, 1986 10:52:56 am PDT
DIRECTORY Controls, Imager, IO, Matrix3d, Menus, Rope, Spline3d, TubeDefs, Vector3d;
TubeStructure:
CEDAR
DEFINITIONS
~ BEGIN
OPEN TubeDefs;
PropagateCircleRes:
PUBLIC
PROC [tube: Tube, circleRes:
NAT];
Change circular resolution to circleRes for tube.
PropagateFrames:
PROC [
tube: Tube, scale, epsilon: REAL ← 1.0, taper: REAL ← 0.0, view: Matrix ← NIL];
MakeFrames for each of the spline segments in tube. Epsilon controls the subdivision. If
view is nil, the tube is considered only in object space and epsilon is the same discriminator
as in Spline3d.FlatBezier; if view is non-nil, epsilon is the number of pixels the straight line
approximation is permitted to deviate from the curve as transformed to screen-space.
MakeFrames:
PROC [tube: Tube, scale0, scale1, epsilon:
REAL ← 1.0, view: Matrix ←
NIL];
Create sequence of frames for the entire limb. See PropagateFrames for an explanation of
epsilon and view.
TubeResInfo:
PUBLIC
PROC [tube: Tube]
RETURNS [nPoints, nPolys, minCres, maxCres: INTEGER];
Return the total number of points and polygons in a tube.
GetCircle:
PUBLIC
PROC [res:
NAT]
RETURNS [PairSequence];
Get a planar circle for subsequent tubular constructions.
Basis:
PROC [v, vv, rv: Triple]
RETURNS [n, b: Triple];
Given tangent v along a curve, previous tangent vv, and reference vector rv, compute vectors n and b; v, n, and b form a new set of axes; the transformation of the x, y, and z axes to v, n, and b accomodates the twist in the curve; n and b are unitized
RefMatrix:
PROC [p, x, y, z: Triple, s, t:
REAL, out: Matrix ←
NIL]
RETURNS [Matrix];
Return matrix which transforms origin to p, xaxis to x, yaxis to y and zaxis to z; twist around z by t degrees and scale by s.
ScreenPick:
PROC [tube: Tube, mouse: Mouse, view: Matrix, pick: Pick];
Called from a Controls.GraphicsProc; given a sequence of splines, the current mouse, and the current view, set the PickData.
FindPick:
PROC [tube: Tube, mouse: Mouse, view: Matrix, pick: Pick];
Given a sequence of splines, the mouse and the current view, set pd.t and pd.s.
PointPick:
PROC [pick: Pick];
Given pd.s, set pd.sPick0 and pd.sPick1, as well as the selected field in all pd.s.
SplinePick:
PROC [mouse: Mouse, pick: Pick];
Given a pd.t and pd.s, set pd.dividePending, pick.sPt0, pick.sPt1, pick.ptPicked, pick.tangent; set pick.sPick0 and pick.sPick1 to NIL.
DivideSpline:
PROC [pick: Pick];
Divide selected spline at point selected.
NewSplits:
PROC [pick: Pick];
Compute newly divided splines.
ChangeTangent:
PROC [tube: Tube, pick: Pick, tangent: Triple];
Change tangent at selected point.
ChangePosition:
PROC [tube: Tube, pick: Pick, change: Triple];
Change location of selected point.
NumberSplines:
PROC [tube: Tube]
RETURNS [n:
NAT ← 0];
Return number of splines sequenced after "splines."
NumberPicked:
PROC [pick: Pick]
RETURNS [n:
NAT ← 0];
Return number of picked splines.
BeforePicked:
PROC [pick: Pick]
RETURNS [n:
NAT ← 0];
Return number of splines prior to picked sequence.
AfterPicked:
PROC [pick: Pick]
RETURNS [n:
NAT ← 0];
Return number of splines following picked sequence.
END.