ImplicitPoints.mesa
Copyright Ó 1985, 1990 by Xerox Corporation. All rights reserved.
Bloomenthal, February 26, 1993 2:49 pm PST
DIRECTORY G3dBasic, G3dMatrix, G3dOctree, G3dShape, ImplicitDefs, Rope;
~
BEGIN
PairSequence: TYPE ~ G3dBasic.PairSequence;
Triple: TYPE ~ G3dBasic.Triple;
TripleSequence: TYPE ~ G3dBasic.TripleSequence;
Matrix: TYPE ~ G3dMatrix.Matrix;
Viewport: TYPE ~ G3dMatrix.Viewport;
Cross: TYPE ~ G3dOctree.Cross;
CrossedEdge: TYPE ~ G3dOctree.CrossedEdge;
CrossedEdges: TYPE ~ G3dOctree.CrossedEdges;
CrossArray: TYPE ~ G3dOctree.CrossArray;
Cube: TYPE ~ G3dOctree.Cube;
CubeProc: TYPE ~ G3dOctree.CubeProc;
Corner: TYPE ~ G3dOctree.Corner;
Edge: TYPE ~ G3dOctree.Edge;
TwoCorners: TYPE ~ G3dOctree.TwoCorners;
VertexSequence: TYPE ~ G3dShape.VertexSequence;
ColorProc: TYPE ~ ImplicitDefs.ColorProc;
EdgeMode: TYPE ~ ImplicitDefs.EdgeMode;
NormalProc: TYPE ~ ImplicitDefs.NormalProc;
Surface: TYPE ~ ImplicitDefs.Surface;
TextureProc: TYPE ~ ImplicitDefs.TextureProc;
ValueProc: TYPE ~ ImplicitDefs.ValueProc;
Vertex: TYPE ~ ImplicitDefs.Vertex;
VertexOkProc: TYPE ~ ImplicitDefs.VertexOkProc;
ROPE: TYPE ~ Rope.ROPE;
NoCrossedEdge: ERROR;
CrossedEdge Procedures
IsOutOfRange:
PROC [cube: Cube]
RETURNS [
BOOL];
Return true if any of the cube corners are out of range.
IsCrossed:
PROC [cube: Cube]
RETURNS [
BOOL];
Return true if the surface crosses any of cube's edges. Can raise ValueNotSet.
CubeCrossedEdges:
PROC [cube: Cube]
RETURNS [CrossedEdges];
Return those edges crossed by the surface.
CrossedEdgeCorners:
PROC [cube: Cube]
RETURNS [TwoCorners];
Return the two corners of first encountered crossed edge; may raise ERROR NoCrossedEdge.
CrossedPoint:
PROC [
crossedEdge: CrossedEdge,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
normalProc: NormalProc ¬ NIL,
tolerance: REAL ¬ 0.0001,
edgeMode: EdgeMode ¬ binarySectioning,
clientData: REF ANY ¬ NIL]
RETURNS [Cross];
Return location of edge-surface intersection; compute the location if unset.
If normalProc is non-NIL, compute the normal if unset.
tolerance controls the convergence along the cube edges.
CrossFromCrossedEdge:
PROC [crossedEdge: CrossedEdge]
RETURNS [cross: Cross];
Return the cross for this crossedEdge; may rais ERROR NoCrossedEdge.
VertexId:
PROC [crossedEdge: CrossedEdge]
RETURNS [
INTEGER];
Return the vertex id number for this crossedEdge; may raise ERROR NoCrossedEdge.
Cube Procedures
CheckAndGetCrossedEdges:
PROC [
cube: Cube,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
normalProc: NormalProc ¬ NIL,
tolerance: REAL ¬ 0.0001,
clientData: REF ANY ¬ NIL]
RETURNS [CrossedEdges];
Insure all cube values set and surface crosses converged.
SetCornerValue:
PROC [corner: Corner, value:
REAL];
Set the value field of corner and set valueSet to TRUE.
corner.inside is TRUE iff value > 0.
SetCornerValues:
PROC [
cube: Cube,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL];
For terminal cubes, set value of any unset corners.
SetKidValues:
PROC [
parent: Cube,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY];
Set the unset corner values of those corners of parent's kids that aren't shared with parent.
SetCrosses:
PROC [
cube: Cube,
crossedEdges: CrossedEdges,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
normalProc: NormalProc ¬ NIL,
tolerance: REAL ¬ 0.0001,
edgeMode: EdgeMode ¬ binarySectioning,
clientData: REF ANY ¬ NIL];
For terminal cubes, set location of edge-surface intersections of any unset corners.
tolerance controls the convergence along the cube edges.
NextCWEdgeCrossed:
PROC [edge: Edge, crossedEdges: CrossedEdges]
RETURNS [Edge];
Return the next edge clockwise from edge that contains a surface crossedEdge.
GetCrossArray:
PROC [crossedEdges: CrossedEdges]
RETURNS [CrossArray];
Return array of crosses.
Root Procedures
SetTerminalCubeValues:
PROC [
root: Cube,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL];
Set the value of any unset corner of cube.
SetTerminalCubeCornerValuesAndCrossedPoints:
PROC [
root: Cube,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
normalProc: NormalProc ¬ NIL,
cubeProc: CubeProc ¬ NIL,
tolerance: REAL ¬ 0.0001,
edgeMode: EdgeMode ¬ binarySectioning,
clientData: REF ANY ¬ NIL]
RETURNS [nImplicitEvaluations: INT];
For terminal cubes, compute any unset surface-edge intersections.
cubeProc is simply for reporting and/or client abort.
tolerance controls the convergence along the cube edges.
nImplicitEvaluations does not include the evaluations for convergence along an edge.
NVerticesInRoot:
PROC [root: Cube]
RETURNS [
INTEGER];
Return the number of surface crossedEdges in the linear volume.
Surface Procedures
SetSurfaceVertices:
PROC [
surface: Surface,
root: Cube,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
normalProc: NormalProc ¬ NIL,
cubeProc: CubeProc ¬ NIL,
vertexOkProc: VertexOkProc ¬ NIL,
clientData: REF ANY ¬ NIL]
RETURNS [message: ROPE];
Set the vertex sequence field of surface.
The vertex normals are set (whether or not normalProc is NIL).
cubeProc is called for all terminal cubes intersecting the surface;
if it returns FALSE, the vertex operation is aborted.
Set any unset terminal cube corner values and compute any needed surface intersections.
AddSurfaceVertex:
PUBLIC PROC [point, normal: Triple, surface: Surface]
RETURNS [vertexId: INT];
SetVertexTextures:
PROC [
surface: Surface,
textureProc: TextureProc,
cubeProc: CubeProc ¬ NIL,
clientData: REF ANY ¬ NIL];
Set the vertex texture coordinates.
SetVertexColors:
PROC [
surface: Surface,
colorProc: ColorProc,
cubeProc: CubeProc ¬ NIL,
clientData: REF ANY ¬ NIL];
Set the vertex colors.
SetVertexScreenCoords:
PROC [s: Surface, v: Matrix, vp: Viewport];
Transform vertices to screen space.
VertexScreenCoordsValid:
PROC [surface: Surface]
RETURNS [
BOOL];
Return true iff surface and surface.vertices # NIL and surface.pairsValid.
SetVertexScreenCoordsInvalid:
PROC [surface: Surface];
Insure subsequent recalculation of vertex screen coordinates.
SetVertexNormals:
PROC [surface: Surface, cubeProc: CubeProc ¬
NIL];
Set the vertex normals using a polygon weighting method;
this is inferior to computing the normal according to the surface gradient.
GetPointNormal:
PROC [
point: Triple,
valueProc: ValueProc,
value, delta: REAL,
clientData: REF ANY ¬ NIL]
RETURNS [Triple];
Get the unitized normal at point; value is the non-thresholded value at point;
delta is the sampling distance, recommended to be 0.01*cubeSize.
Vertex Procedures
GetVertex:
PROC [vertices: VertexSequence, nVertex:
NAT]
RETURNS [Vertex]
Return vertex n from vertices.
~ INLINE {RETURN[vertices[nVertex]]};
DecodePoints:
PROC [surface: Surface, points: TripleSequence ¬
NIL]
RETURNS [TripleSequence];
Return a sequence of three dimensional points representing the surface vertex locations.
DecodeNormals:
PROC [surface: Surface, normals: TripleSequence ¬
NIL]
RETURNS [TripleSequence];
Return a sequence of three dimensional normals representing the surface vertex normals.
DecodeTextures:
PROC [surface: Surface, textures: PairSequence ¬
NIL]
RETURNS [PairSequence];
Return a sequence of two dimensional textures representing the surface vertex textures.
DecodeColors:
PROC [surface: Surface, colors: TripleSequence ¬
NIL]
RETURNS [TripleSequence];
Return a sequence of three dimensional colors representing the surface vertex colors.