G3dPlane.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Ken Fishkin, August 20, 1992 4:08 pm PDT
Jules Bloomenthal July 14, 1992 2:03 pm PDT
DIRECTORY G3dBasic, G3dMatrix, IO, Rope;
G3dTetrahedron: CEDAR DEFINITIONS
~ BEGIN
Errors
Error: ERROR [reason: Rope.ROPE];
Type Declarations
A tetrahedron simply consists of transformations which map to and from barycentric coordinates
TetrahedronRep: TYPE ~ RECORD [
from3d:     G3dMatrix.Matrix ¬ NIL,
fromBary:    G3dMatrix.Matrix ¬ NIL
];
Tetrahedron:  TYPE ~ REF TetrahedronRep;
Creation
Create: PROC [p0, p1,p2,p3: G3dBasic.Triple] RETURNS [Tetrahedron];
Return the Tetrahedron with the four given vertices.
Copy: PROC [Tetrahedron] RETURNS [Tetrahedron];
Return the Tetrahedron with the four given vertices.
Operation
MapFromBarycentric: PROC [t: Tetrahedron, pt: G3dBasic.Quad] RETURNS [G3dBasic.Quad];
Given 4-tuple barycentric coords of a point inside the tetrahedron, return that point.
MapFrom3D: PROC [t: Tetrahedron, pt: G3dBasic.Quad] RETURNS [G3dBasic.Quad];
The inverse: MapFromBarycentric[Mapfrom3D[p]] = p.
IsInside: PROC [t: Tetrahedron, pt: G3dBasic.Quad, tol: REAL ¬ 0.001] RETURNS [BOOL];
Is a given point within the given tetrahedron? Requires a full matrix multiply: use only if
cutting planes are not available/desirable. tol is the tolerance to reduce precision error.
BoundingBox: PROC [t: Tetrahedron] RETURNS [G3dBasic.Box];
I/O
Read: PROC[IO.STREAM] RETURNS [Tetrahedron];
Write: PROC[Tetrahedron, IO.STREAM];
Debug
Debug: PROC [dbg: IO.STREAM];
Sets module debugging. debugging is turned off (the default) by setting dbg to NIL.
END.