-- File: SweepCast.mesa
-- Last edited by Bier on December 18, 1982 1:23 am
-- Author: Eric Bier on July 3, 1983 1:59 pm
-- Contents: Ray Tracing Code for linear and revolute sweep shapes.
DIRECTORY
CastRays,
CSG,
SV2d,
SVFaces,
SweepGeometry,
SVBoundBox,
SVPolygon2d,
SVVector3d;
SweepCast: DEFINITIONS =
BEGIN
-- IMPORTED TYPES
BoundBox: TYPE = SVBoundBox.BoundBox;
Classification: TYPE = REF ClassificationObj;
ClassificationObj: TYPE = CastRays.ClassificationObj;
EdgeOnRect: TYPE = SVFaces.EdgeOnRect;
LinearMesh: TYPE = REF LinearMeshRecord;
LinearMeshRecord: TYPE = SweepGeometry.LinearMeshRecord;
Polygon: TYPE = SVPolygon2d.Polygon;
Primitive: TYPE = CSG.Primitive;
Ray: TYPE = REF RayObj;
RayObj: TYPE = CastRays.RayObj;
RevoluteMesh: TYPE = SweepGeometry.RevoluteMesh;
Point2d: TYPE = SV2d.Point2d;
Vector: TYPE = SVVector3d.Vector;
-- TYPES DEFINED HERE
LinSweepFaces: TYPE = REF LinSweepFacesObj;
LinSweepFacesObj: TYPE = RECORD [
mesh: LinearMesh, poly: Polygon, len: NAT, seq: SEQUENCE maxFaces: NAT OF EdgeOnRect];
RevoSweepFaces: TYPE = REF RevoSweepFacesObj;
RevoSweepFacesObj: TYPE = RECORD [
mesh: RevoluteMesh, len: NAT, seq: SEQUENCE maxFaces: NAT OF RevoFace];
RevoFace: TYPE = REF ANY;
-- will be an SVFaces.Cone, SVFaces.DiskRing, or SVFaces.Cylinder;
SubBoxesBody: TYPE = REF SubBoxesBodyObj;
SubBoxesBodyObj: TYPE = RECORD [
len: NAT, seq: SEQUENCE maxFaces: NAT OF BoundBox];
RevoHitArray: TYPE = REF RevoHitArrayObj;
RevoHitArrayObj: TYPE = RECORD [
count: NAT,
array: ARRAY[1..SweepGeometry.maxLinesOfLat+1] OF RevoHitRec,
inOuts: ARRAY[1..SweepGeometry.maxLinesOfLat+1] OF BOOL
];
RevoHitRec: TYPE = REF RevoHitRecObj;
RevoHitRecObj: TYPE = RECORD [
param: REAL, normal: Vector, lineOfLatitude: NAT];
LinHitArray: TYPE = REF LinHitArrayObj;
LinHitArrayObj: TYPE = RECORD [
count: NAT,
array: ARRAY[1..SweepGeometry.maxMeshLen-1] OF LinHitRec
];
LinHitRec: TYPE = REF LinHitRecObj;
LinHitRecObj: TYPE = RECORD [
param: REAL, normal: Vector, index: NAT];
-- index of front is 0, back is linMesh.len + 1;
LinCast: PROC [localRay: Ray, prim: Primitive, linMesh: LinearMesh, faces: LinSweepFaces] RETURNS [class: Classification];
RevoCast: PROC [cameraPoint: Point2d, localRay: Ray, prim: Primitive, faces: RevoSweepFaces, boxes: SubBoxesBody] RETURNS [class: Classification];
-- prim contains a RevoSweepFaces in prim.hints.
RevoCastNoBBoxes: PROC [localRay: Ray, prim: Primitive, faces: RevoSweepFaces] RETURNS [class: Classification];
MakeRevoSweepFaces: PROC [revMesh: RevoluteMesh] RETURNS [faces: RevoSweepFaces];
MakeLinSweepFaces: PROC [linMesh: LinearMesh] RETURNS [faces: LinSweepFaces];
END.