-- File: SV2d.mesa
-- Last edited by Bier on December 18, 1982 1:01 am
-- Author: Eric Bier on August 20, 1982 11:39 am
-- Contents: Definitions of data structures used to represent two dimensional entities, and procedures to support them. Part of the Solidviews Three Dimensional Illustrator.
SV2d: DEFINITIONS =
BEGIN
Point2d: TYPE = ARRAY[1..2] OF REAL;
-- Not currently used
Ray2d: TYPE = REF Ray2dObj;
Ray2dObj: TYPE = RECORD [
p, qMinusP: Point2d];
maxPolyEdges: NAT = 20;
-- Not currently used
Classif2d: TYPE = REF Classif2dObj;
Classif2dObj: TYPE = RECORD [
count: NAT,
params: ParamArray,
classifs: ClassifArray,
edges: EdgeArray];
-- Not currently used
ParamArray: TYPE = ARRAY [1..maxPolyEdges] OF REAL;
ClassifArray: TYPE = ARRAY [1..maxPolyEdges+1] OF InOutOn;
InOutOn: TYPE = {in, out, on};
EdgeArray: TYPE = ARRAY [1..maxPolyEdges] OF Edge;
Edge: TYPE = RECORD[v1, v2: Point2d];
-- Polygons and Paths
Polygon: TYPE = REF PolygonObj;
PolygonObj: TYPE = RECORD [
len: NAT, seq: SEQUENCE maxVerts: NAT OF Point2d];
Path: TYPE = REF PathObj;
PathObj: TYPE = RECORD [
len: NAT, seq: SEQUENCE maxVerts: NAT OF Point2d];
TrigPolygon: TYPE = REF TrigPolygonObj;
TrigPolygonObj: TYPE = RECORD [
len: NAT, seq: SEQUENCE maxVerts: NAT OF TrigLineSeg];
-- not currently used
Intersection: TYPE = REF IntersectionObj;
IntersectionObj: TYPE = RECORD [
t: REAL,
edge: Edge];
IntersectionRec: TYPE = REF IntersectionRecObj;
IntersectionRecObj: TYPE = RECORD [
array: ARRAY [1..maxPolyEdges] OF Intersection,
len: NAT];
-- a possible substitute for TrigLineSeg
LineSeg: TYPE = REF LineSegObj;
LineSegObj: TYPE = RECORD [
p1, p2: Point2d,
slope: REAL,
xInt, yInt: REAL,
isVert: BOOL
];
TrigLineSeg: TYPE = REF TrigLineSegObj;
-- a TrigLine with endpoints pLo and pHi.
-- pLo has lower y than pHi or the same y and lower x.
TrigLineSegObj: TYPE = RECORD [
line: TrigLine,
pLo, pHi: Point2d,
pLoIsFirst: BOOL]; -- are [pLo, pHi] in the same order as [v1, v2] (the segment endpoints as they are given to CreateTrigLineSeg)?
TrigLine: TYPE = REF TrigLineObj;
TrigLineObj: TYPE = RECORD [
-- line equation of the form: y*cos(theta) - x*sin(theta) -d = 0;
-- where theta is the angle which the line makes with the x axis and d is the distance from the line to the origin.
c: REAL, -- cos(theta)
s: REAL, -- sin(theta)
theta: REAL, -- angle in (-pi..pi]
d: REAL, -- distance from line to origin
slope: REAL, -- slope and yInt are redundant information but they come almost for free.
yInt: REAL
];
END.