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;
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.
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:
BOOL ←
FALSE]
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.
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:
BOOL ←
TRUE]
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.
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:
BOOL ←
TRUE];
Apply tubeProc to tube.branches and, iff nextAlso true, to tube.next.
ApplyToSiblings:
PUBLIC
PROC [tube: Tube, tubeProc: TubeProc, tubeAlso:
BOOL ←
TRUE];
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.