Plane3d.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Bloomenthal, February 19, 1986 10:34:41 am PST
DIRECTORY Rope, Vector3d;
Plane3d:
CEDAR
DEFINITIONS
~ BEGIN
Triple: TYPE ~ Vector3d.Triple;
Quad: TYPE ~ Vector3d.Quad;
Line: TYPE ~ Vector3d.Line;
Circle: TYPE ~ RECORD [center: Triple, radius: REAL];
Error: ERROR [code: ATOM, reason: Rope.ROPE];
Plane Operations
Normalize:
PROC [plane: Quad]
RETURNS [Quad];
Can raise Error[$NullVec, "null plane normal"]; return normalized plane.
FromPts:
PROC [p1, p2, p3: Triple]
RETURNS [Quad];
Can raise Error[$NullVec, "points colinear"]; return plane passing through three points.
FromPtNrm:
PROC
[point, normal: Triple]
RETURNS [Quad];
Can raise Error[$NullVec, "null plane normal"];
return plane given point on plane and normal to plane.
IntWithLine:
PROC
[plane: Quad, line: Line]
RETURNS [Triple];
Can raise Error[$ZeroDiv, "no intersection"];
return intersection point of plane and line given by base and axis.
TriArea:
PUBLIC PROC [p0, p1, p2: Triple]
RETURNS [
REAL];
Return the area of the triangle.
CircleFromPts:
PROC [p1, p2, p3: Triple]
RETURNS [Circle];
Can raise Error[$NullVec, "points collinear"];
find center and radius of circle passing through given three points.
IntOf3:
PROC [p1, p2, p3: Quad]
RETURNS [Triple];
Can raise Error[$ZeroDiv, "no intersection"]; return point of intersection of planes.
IntOf2:
PROC [plane1, plane2: Quad]
RETURNS [base, axis: Triple];
Can raise Error[$NullVec, "no intersection"];
return base and axis of line intersection of planes.
Center:
PROC [plane: Quad]
RETURNS [Triple];
Return intersection of plane and line from origin normal to plane.
DistanceToPt:
PROC [point: Triple, plane: Quad]
RETURNS [
REAL];
Can raise Error[$NullVec, "null plane normal"]; return the distance from a point to a plane.