File: SVSlices.mesa
Last edited by: Eric Bier on August 1, 1985 2:28:18 pm PDT
Copyright © 1984 by Xerox Corporation. All rights reserved.
Contents: A scanline data structure representing a ray-traced slice thru a 3D scene. Can be shown in 3D by drawing the endpoints in perspective or in 2D by rotating the slicing plane into the viewing plane.
DIRECTORY
Imager,
SV2d,
SV3d,
SVModelTypes,
SVRayTypes,
SVSceneTypes;
SVSlices: CEDAR DEFINITIONS =
BEGIN
Camera: TYPE = SVModelTypes.Camera;
Classification: TYPE = SVRayTypes.Classification;
CoordSystem: TYPE = SVModelTypes.CoordSystem;
CSGTree: TYPE = SVRayTypes.CSGTree;
FrameBlock: TYPE = SVSceneTypes.FrameBlock;
Point2d: TYPE = SV2d.Point2d;
Point3d: TYPE = SV3d.Point3d;
Ray: TYPE = SVRayTypes.Ray;
SliceScanLine: TYPE = REF SliceScanLineObj;
SliceScanLineObj: TYPE = RECORD [
lineVal: REAL,
hits: ARRAY [1..SVRayTypes.maxSceneDepth] OF Point3d,
classifs: ARRAY [1..SVRayTypes.maxSceneDepth] OF BOOL,
count: NAT];
Slice: TYPE = REF SliceObj;
SliceObj: TYPE = RECORD [
coordSys: CoordSystem, frame: FrameBlock, plane: NAT, seq: SEQUENCE maxScans: NAT OF SliceScanLine];
CreateSlice: PROC [maxScans: NAT, coordSys: CoordSystem, frame: FrameBlock, plane: NAT] RETURNS [slice: Slice];
UpdateSlice: PROC [slice: Slice, coordSys: CoordSystem, frame: FrameBlock, plane: NAT];
ChangeSlicePlane: PROC [slice: Slice, plane: NAT];
RayTraceTheSlice: PROC [slice: Slice, tree: CSGTree, camera: Camera];
WidthAndHeight: PROC [slice: Slice] RETURNS [width, height: REAL];
Uses the dimensions of the framebox and the current plane to determine the size of the rectangle this slice will project to in the chosen plane.
DrawSlice: PROC [dc: Imager.Context, slice: Slice, origin: Point2d];
Draw the slice in a 2d window such as the scratchpad.
DrawSlice3d: PROC [dc: Imager.Context, slice: Slice, camera: Camera];
Draw the outline of the slice in with a set of solid objects.
END.