TubeMisc.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Bloomenthal, January 21, 1987 4:53:37 pm PST
DIRECTORY Controls, Imager, IO, Matrix3d, Menus, Rope, Spline3d, TubeDefs, Vector3d;
TubeMisc: CEDAR DEFINITIONS
~ BEGIN
OPEN TubeDefs;
Points and Polygons Procedures
Points: PUBLIC PROC [
tube: Tube, pointProc: PointProc, view: Matrix ← NIL] RETURNS [nPoints: INT];
Apply pointProc to the points in tube; first transform the points by view, if non-nil.
Polys: PUBLIC PROC [tube: Tube, polyProc: PolyProc] RETURNS [nPolys: INT];
Apply polyProc to the polygons in tube.
Miscellany
Find: PUBLIC PROC [searchee, search: Tube] RETURNS [BOOL];
Return true iff searchee is somewhere within search.
First: PUBLIC PROC [tube: Tube] RETURNS [Tube];
Return the first antecedent of tube (that is, tube.prev.prev etc. such that tube.prev = NIL).
Delete: PUBLIC PROC [tube: Tube];
Delete this tube and all its descendents.
UnSelectAll: PUBLIC PROC [tube: Tube];
Set select field to FALSE for tube and its descendents.
SetTubeLengths: PUBLIC PROC [tube: Tube];
Set the length fields for tube and its descendents.
Branching
NewBranch: PUBLIC PROC [tube: Tube] RETURNS [Tube];
Fabricate a branch beginning at the end of tube.
AddBranch: PUBLIC PROC [tube, branch: Tube];
Add the branch to the end of tube.
Nearness Procedures
NearestTube: PUBLIC PROC [tube: Tube, point: Triple, tolerance: REAL ← 0.01]
RETURNS [Tube];
Check tube and its descendents for the closest point to point.
Set the tube fields: nearP, nearT, and nearDist.
Radius Procedures
Radius: PUBLIC PROC [tube: Tube, t: REAL, roundTip: BOOLFALSE] RETURNS [REAL];
Return the tube radius at parametric position t.
If roundTip and tube has no .next, then attenuate the radius to form a hemispherical tip.
SetDescendantRadii: PROC [tube: Tube, mode: RadiusMode];
Set the tube's descendents' radii such that, if radiusMode is linear, their sum equals tube.r1,
else, if square, the sum of their squares equals the square of tube.r1.
Attributes Procedures
TubeHull: PROC [tube: Tube] RETURNS [Hull];
Return interesting attributes of the tube.
Information Procedures
NTubes: PROC [tube: Tube] RETURNS [INTEGER];
Return the number of tubes (tube and its descendents).
NBranches: PROC [tube: Tube] RETURNS [INTEGER];
Return the number of branches of tube.
NSiblings: PROC [tube: Tube, tubeAlso: BOOLTRUE] RETURNS [INTEGER];
Return the number of siblings of tube, including, iff tubeAlso, tube.
NFrames: PROC [tube: Tube] RETURNS [INTEGER];
Return the number of frames of tube.
NPoints: PROC [tube: Tube] RETURNS [INT];
Return the number of points in the tube.
NPolys: PROC [tube: Tube] RETURNS [INT];
Return the number of polygons in the tube.
NSplinesInBranch: PUBLIC PROC [tube: Tube] RETURNS [INT];
Return the number of splines in the branch.
Info: PUBLIC PROC [tube: Tube] RETURNS [nPoints, nPolys, minCres, maxCres: INT];
Return the total number of points and polygons in a tube, and the extremes of circle res.
Copy Procedure
Copy: PUBLIC PROC [tube: Tube] RETURNS [copy: Tube];
Return a copy of the input tube.
Call Back Procedure for Tube Sections
tubeProc is applied to a subset of tube; a tubeProc is called only if its argument is non-NIL.
ApplyToTube: PUBLIC PROC [tube: Tube, tubeProc: TubeProc];
Apply tubeProc recursively to tube and its descendant tubes (tube.next, and tube.branches).
ApplyToBranches: PUBLIC PROC [tube: Tube, tubeProc: TubeProc, nextAlso: BOOLTRUE];
Apply tubeProc to tube.branches and, iff nextAlso true, to tube.next.
ApplyToSiblings: PUBLIC PROC [tube: Tube, tubeProc: TubeProc, tubeAlso: BOOLTRUE];
Apply tubeProc to siblings of tube and, iff tubeAlso true, to tube.
Details Procedures
ToggleDetail: PUBLIC PROC [
details: Details, toToggle: DetailType, trueName, falseName: ROPE, outerData: OuterData];
Toggle the specified detail and relabel its button.
DetailState: PUBLIC PROC [details: Details, type: DetailType] RETURNS [BOOL];
Return the state of the type of detail.
Pendings Procedures
ClearPendings: PUBLIC PROC [pendings: Pendings];
Set all the pendings fields to FALSE.
END.