ImplicitRayTrace.mesa
Copyright Ó 1985, 1990 by Xerox Corporation. All rights reserved.
Bloomenthal, August 11, 1992 4:07 pm PDT
DIRECTORY CedarProcess, Controls, CtBasic, Draw2d, G3dBasic, G3dControl, G3dMatrix, G3dOctree, G3dRayTrace, Rope, ImplicitDefs, ViewerClasses;
ImplicitRayTrace: CEDAR DEFINITIONS
~ BEGIN
Imported Types
Process:    TYPE ~ CedarProcess.Process;
ButtonList:   TYPE ~ Controls.ButtonList;
ControlList:   TYPE ~ Controls.ControlList;
OuterData:   TYPE ~ Controls.OuterData;
RGB:     TYPE ~ CtBasic.RGB;
DrawProc:   TYPE ~ Draw2d.DrawProc;
Ray:     TYPE ~ G3dBasic.Ray;
Triple:    TYPE ~ G3dBasic.Triple;
Camera:    TYPE ~ G3dControl.Camera;
Matrix:    TYPE ~ G3dMatrix.Matrix;
Intersection:   TYPE ~ G3dOctree.Intersection;
Octree:    TYPE ~ G3dOctree.Octree;
RayData:    TYPE ~ G3dRayTrace.RayData;
RayProc:    TYPE ~ G3dRayTrace.RayProc;
NormalProc:   TYPE ~ ImplicitDefs.NormalProc;
ValueProc:   TYPE ~ ImplicitDefs.ValueProc;
ROPE:     TYPE ~ Rope.ROPE;
Viewer:    TYPE ~ ViewerClasses.Viewer;
xAxis:     Triple ~ G3dBasic.xAxis;
yAxis:    Triple ~ G3dBasic.yAxis;
zAxis:     Triple ~ G3dBasic.zAxis;
Local Types
RayHit:    TYPE ~ RECORD [
point:       Triple ¬ [],
value:       REAL ¬ 0.0,
t:        REAL ¬ 0.0,
type:       {entering, leaving, empty} ¬ empty
];
RayHitList:   TYPE ~ LIST OF RayHit;
SurfacePoint:   TYPE ~ RECORD [point, normal: Triple, value: REAL];
Ray Tracing Implicit Functions
Error: ERROR [reason: ROPE];
GetRayHit: PROC [
i0, i1: Intersection,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL,
epsilon: REAL ¬ 0.0]
RETURNS [RayHit];
Converge along the line segment between i0.point and i1.point and return the ray hit.
(i0.value > 0.0) is presumed # (i1.value > 0.0).
Epsilon is the minimum distance allowed in the convergence. Recursion depth limited to 15.
GetRayHits: PROC [
i0, i1: Intersection,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL,
epsilon: REAL ¬ 0.0]
RETURNS [hits: RayHitList];
Return a list of hits between i0 and i1.
RayIntersection: PROC [
ray: Ray,
octree: Octree,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL]
RETURNS [RayHit];
Return the first ray hit of the surface. Can raise Error["No intersection"];
RayIntersections: PROC [
ray: Ray,
octree: Octree,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL]
RETURNS [RayHitList];
Return a list of all ray hits with the surface.
RayAtSurface: PROC [
ray: Ray,
octree: Octree,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
normalProc: NormalProc ¬ NIL,
clientData: REF ANY ¬ NIL]
RETURNS [SurfacePoint];
Return location and normal at first ray hit of surface. Can raise Error["No intersection"];
RayThroughSurface: PROC [
ray: Ray,
octree: Octree,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL]
RETURNS [thickness: REAL, firstHit: RayHit];
Return accumulated thickness of ray through the surface.
ray is presumed normalized (so that t is in distance units).
InShadow: PROC [
octree: Octree,
surfacePoint, lightDirection: Triple,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL]
RETURNS [BOOL];
True if ray from the surfacePoint towards the lightDirection is interupted by the surface.
AnyHit: PROC [
i0, i1: Intersection,
valueProc: ValueProc,
threshold: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL]
RETURNS [BOOL];
True if any surface exists between the two intersections.
END.