Create:
PUBLIC
PROC [p0, p1,p2,p3: G3dBasic.Triple]
RETURNS [Tetrahedron] ~ {
ans: Tetrahedron ¬ NEW[TetrahedronRep];
ans.fromBary ¬ NEW[G3dMatrix.MatrixRep];
ans.fromBary[0] ¬ [p0.x,p0.y,p0.z,1.0];
ans.fromBary[1] ¬ [p1.x,p1.y,p1.z,1.0];
ans.fromBary[2] ¬ [p2.x,p2.y,p2.z,1.0];
ans.fromBary[3] ¬ [p3.x,p3.y,p3.z,1.0];
ans.from3d ¬ G3dMatrix.Invert[ans.fromBary];
RETURN [ans];
};
Copy:
PUBLIC
PROC [t: Tetrahedron]
RETURNS [Tetrahedron] ~ {
ans: Tetrahedron;
IF t = NIL THEN RETURN[NIL];
ans ¬ NEW[TetrahedronRep];
ans.from3d ¬ G3dMatrix.CopyMatrix[t.from3d];
ans.fromBary ¬ G3dMatrix.CopyMatrix[t.fromBary];
RETURN [ans];
};