ImplicitStorage.mesa
Copyright © 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, January 2, 1993 2:24 pm PST
DIRECTORY G3dBasic, G3dMatrix, G3dShape, G3dTriangle;
ImplicitStorage: CEDAR DEFINITIONS
~ BEGIN
Types
Triple:   TYPE ~ G3dBasic.Triple;
Matrix:   TYPE ~ G3dMatrix.Matrix;
Viewport:   TYPE ~ G3dMatrix.Viewport;
Vertices:   TYPE ~ G3dShape.VertexSequence;
IntTriple:   TYPE ~ G3dTriangle.IntTriple;
Centers:   TYPE ~ RECORD [s: SEQUENCE length: INT OF LIST OF IntTriple];
ID:    TYPE ~ RECORD [id: IntTriple, vid: INT ¬ 0];
IDs:    TYPE ~ RECORD [s: SEQUENCE length: INT OF LIST OF ID];
Edge:    TYPE ~ RECORD [i1, i2: IntTriple, vid: INT ¬ 0];
Edges:   TYPE ~ RECORD [s: SEQUENCE length: INT OF LIST OF Edge];
Face:    TYPE ~ RECORD [i1, i2, i3: IntTriple, vIDs: LIST OF INT];
Faces:    TYPE ~ RECORD [s: SEQUENCE length: INT OF LIST OF Face];
Vertices
ScreenPick: PROC [p: G3dBasic.IntegerPair, vertices: Vertices, view: Matrix, vp: Viewport]
RETURNS [INT];
Return the index of the vertex closest to the screen point.
Sparse 3d Storage
GetHashSize: PROC RETURNS [INT];
Get the hash size used internally.
Hash: PROC [i: IntTriple] RETURNS [id: INT];
Return the hashed value.
Order2: PROC [i1, i2: IntTriple] RETURNS [IntTriple, IntTriple];
Return i1 and i2 ordered.
Order3: PROC [i1, i2, i3: IntTriple] RETURNS [r1, r2, r3: IntTriple];
Return i1, i2, and i3, ordered.
NewCenters: PROC RETURNS [REF Centers];
Allocate a center sequence.
NewIDs: PROC RETURNS [REF IDs];
Allocate a center sequence.
NewEdges: PROC RETURNS [REF Edges];
Allocate an edge sequence.
NewFaces: PROC RETURNS [REF Faces];
Allocate a face sequence.
AddCenter: PROC [centers: REF Centers, i: IntTriple] RETURNS [BOOL];
Return true if already set; otherwise, set and return false.
SubCenter: PROC [centers: REF Centers, id: IntTriple];
Remove the given center from the table of centers.
SetID: PROC [ids: REF IDs, location: IntTriple, vid: INT];
Set the location id with the given vertex, vid.
GetID: PROC [ids: REF IDs, location: IntTriple] RETURNS [INT];
Retrieve a vertex id from the location id (returns -1 if non-existent).
SetEdge: PROC [edges: REF Edges, i1, i2: IntTriple, vid: INT];
Set the edge with the given vertex id.
GetEdge: PROC [edges: REF Edges, i1, i2: IntTriple] RETURNS [INT];
Retrieve a vertex id from the edge (returns -1 if non-existent).
SetFace: PROC [faces: REF Faces, i1, i2, i3: IntTriple, vid: INT];
Set the edge with the given vertex id.
GetFace: PROC [faces: REF Faces, i1, i2, i3: IntTriple, p: Triple, vertices: Vertices]
RETURNS [INT];
If a vertex of the same location is stored on this face, return its id; else, return -1
GetAllFaceIDs: PROC [faces: REF Faces, i1, i2, i3: IntTriple] RETURNS [ids: LIST OF INT];
Return all the ids associated with this face.
END.