File: ObjectCast.mesa
Last edited by Bier on June 1, 1984 5:13:12 pm PDT
Author: Eric Bier on July 29, 1984 4:47:45 pm PDT
Contents: Procedures to determine intersections of rays with primitive objects
DIRECTORY
SV2d,
SV3d,
SVRayTypes;
ObjectCast: DEFINITIONS =
BEGIN
Composite: TYPE = SVRayTypes.Composite;
CSGTree: TYPE = SVRayTypes.CSGTree;
Point2d: TYPE = SV2d.Point2d;
Point3d: TYPE = SV3d.Point3d;
Primitive: TYPE = SVRayTypes.Primitive;
Surface: TYPE = REF ANY;
Vector: TYPE = SV3d.Vector;
RectSurface: TYPE = REF RectSurfaceObj;
RectSurfaceObj: TYPE = RECORD [
rectType: RectType];
RectType: TYPE = {up, down, left, right, front, back};
TubeSurface: TYPE = REF TubeSurfaceObj;
TubeSurfaceObj: TYPE = RECORD [
];
DiskSurface: TYPE = REF DiskSurfaceObj;
DiskSurfaceObj: TYPE = RECORD [
diskType: DiskType];
DiskType: TYPE = {top, bottom};
ShellSurface: TYPE = REF ShellSurfaceObj;
ShellSurfaceObj: TYPE = RECORD [
];
ConeSurface: TYPE = REF ConeSurfaceObj;
ConeSurfaceObj: TYPE = RECORD [
];
ToroidalSurface: TYPE = REF ToroidalSurfaceObj;
ToroidalSurfaceObj: TYPE = RECORD [
];
ParameterArray: TYPE = SVRayTypes.ParameterArray;
SurfaceArray: TYPE = SVRayTypes.SurfaceArray;
InOutArray: TYPE = SVRayTypes.InOutArray;
NormalArray: TYPE = SVRayTypes.NormalArray;
Classification: TYPE = SVRayTypes.Classification;
Ray: TYPE = SVRayTypes.Ray;
HitRec: TYPE = REF HitRecObj;
HitRecObj: TYPE = RECORD [
t: REAL,
surf: Surface,
normal: Vector];
HitArray: TYPE = REF HitArrayObj;
HitArrayObj: TYPE = ARRAY[1..globalObjDepth] OF HitRec;
globalObjDepth: NAT = 6;
Each primitive shape must have a procedure here which can classify a ray with respect to it.
BlockCast: PROC [localRay: Ray, surfs: SurfaceArray, prim: Primitive] RETURNS [class: Classification];
SphereCast: PROC [localRay: Ray, thisShell: Surface, prim: Primitive] RETURNS [class: Classification];
CylinderCast: PROC [localRay: Ray, surfaces: SurfaceArray, prim: Primitive]
RETURNS [class: Classification];
ConeCast: PROC [localRay: Ray, surfaces: SurfaceArray, prim: Primitive] RETURNS [class: Classification];
ToroidCast: PROC [localRay: Ray, prim: Primitive, torusRec: REF ANY, surface: Surface]
RETURNS [class: Classification];
torusRec is a BasicObject3d.TorusRec. It is a REF ANY to avoid compilation dependencies
END.