File: SVSweepCast.mesa
Last edited by Bier on September 24, 1987 12:20:52 pm PDT
Contents: Ray Tracing Code for linear and revolute sweep shapes.
DIRECTORY
SV2d, SV3d, SVFaces, SVSweepGeometry, SVBasicTypes, SVModelTypes, SVSceneTypes;
SVSweepCast: CEDAR DEFINITIONS =
BEGIN
IMPORTED TYPES
BoundBox: TYPE = SVBasicTypes.BoundBox;
Sphere: TYPE = SV3d.Sphere;
Classification: TYPE = SVSceneTypes.Classification;
EdgeOnRect: TYPE = SVFaces.EdgeOnRect;
LinearMesh: TYPE = SVSweepGeometry.LinearMesh;
Polygon: TYPE = SV2d.Polygon;
Primitive: TYPE = SVSceneTypes.Primitive;
Ray: TYPE = SVSceneTypes.Ray;
RevoluteMesh: TYPE = SVSweepGeometry.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 Sphere];
RevoHitArray: TYPE = REF RevoHitArrayObj;
RevoHitArrayObj:
TYPE =
RECORD [
count: NAT,
array: ARRAY[1..SVSweepGeometry.maxLinesOfLat+1] OF RevoHitRec,
inOuts: ARRAY[1..SVSweepGeometry.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..SVSweepGeometry.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, positiveTOnly: BOOL ← TRUE] RETURNS [class: Classification];
RevoCast:
PROC [cameraPoint: Point2d, localRay: Ray, prim: Primitive, faces: RevoSweepFaces, boxes: SubBoxesBody, positiveTOnly:
BOOL ←
TRUE]
RETURNS [class: Classification];
prim contains a RevoSweepFaces in prim.hints.
RevoCastNoBBoxes: PROC [localRay: Ray, prim: Primitive, faces: RevoSweepFaces, positiveTOnly: BOOL ← TRUE] RETURNS [class: Classification];
RevoCastBoundSpheres: PROC [localRay: Ray, prim: Primitive, faces: RevoSweepFaces, spheres: SubSpheresBody, positiveTOnly: BOOL ← TRUE] RETURNS [class: Classification];
MakeRevoSweepFaces: PROC [revMesh: RevoluteMesh] RETURNS [faces: RevoSweepFaces];
MakeLinSweepFaces: PROC [linMesh: LinearMesh] RETURNS [faces: LinSweepFaces];
END.