File: SweepCast.mesa
Last edited by Bier on June 1, 1987 11:14:09 am PDT
Contents: Ray Tracing Code for linear and revolute sweep shapes.
DIRECTORY
SV2d, SV3d, SVFaces, SweepGeometry, SVBasicTypes, SVModelTypes, SVSceneTypes;
SweepCast: CEDAR DEFINITIONS =
BEGIN
IMPORTED TYPES
BoundBox: TYPE = SVBasicTypes.BoundBox;
BoundSphere: TYPE = SVBasicTypes.BoundSphere;
Classification: TYPE = SVSceneTypes.Classification;
EdgeOnRect: TYPE = SVFaces.EdgeOnRect;
LinearMesh: TYPE = SweepGeometry.LinearMesh;
Polygon: TYPE = SV2d.Polygon;
Primitive: TYPE = SVSceneTypes.Primitive;
Ray: TYPE = SVSceneTypes.Ray;
RevoluteMesh: TYPE = SweepGeometry.RevoluteMesh;
Point2d: TYPE = SV2d.Point2d;
Vector3d: TYPE = SV3d.Vector3d;
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];
SubSpheresBody: TYPE = REF SubSpheresBodyObj;
SubSpheresBodyObj:
TYPE =
RECORD [
len: NAT, seq: SEQUENCE maxFaces: NAT OF BoundSphere];
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: Vector3d, 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: Vector3d, 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];
RevoCastBoundSpheres: PROC [localRay: Ray, prim: Primitive, faces: RevoSweepFaces, spheres: SubSpheresBody] RETURNS [class: Classification];
MakeRevoSweepFaces: PROC [revMesh: RevoluteMesh] RETURNS [faces: RevoSweepFaces];
MakeLinSweepFaces: PROC [linMesh: LinearMesh] RETURNS [faces: LinSweepFaces];
END.