G3dCubeDraw.mesa
Copyright Ó 1985, 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, July 15, 1992 11:07 pm PDT
DIRECTORY Draw2d, G3dMatrix, Imager, G3dOctree;
~
BEGIN
DrawType: TYPE ~ Draw2d.DrawType;
Matrix: TYPE ~ G3dMatrix.Matrix;
Viewport: TYPE ~ G3dMatrix.Viewport;
Cube: TYPE ~ G3dOctree.Cube;
Direction: TYPE ~ G3dOctree.Direction;
DirectionPairs: TYPE ~ G3dOctree.DirectionPairs;
Face: TYPE ~ G3dOctree.Face;
Neighborhood: TYPE ~ G3dOctree.Neighborhood;
OctantPairs: TYPE ~ G3dOctree.OctantPairs;
Context: TYPE ~ Imager.Context;
Transforming Points
TransformDirections:
PROC [cube: Cube, view: Matrix, viewport: Viewport ¬ []]
RETURNS [DirectionPairs];
Transform the cube center and its 26 surrounding points.
TransformOctants:
PROC [cube: Cube, view: Matrix, viewport: Viewport ¬ []]
RETURNS [OctantPairs];
Transform the eight cube corners.
Drawing Face/Cube/Neighborhood
TerminalCubes:
PROC [
context: Context,
cube: Cube,
view: Matrix,
viewport: Viewport ¬ [],
drawType: DrawType ¬ dashed];
Draw all terminal cubes descended from cube.
RecursiveCubes:
PROC [
context: Context,
cube: Cube,
view: Matrix,
viewport: Viewport ¬ [],
drawType: DrawType ¬ dashed,
terminalCenters: BOOL ¬ TRUE];
Draw cube and all its defined subcubes;
if edges, draw edges as solid lines, if terminalCenters, mark centers of the terminal cubes.
SimpleCube:
PROC [
context: Context,
cube: Cube,
view: Matrix,
viewport: Viewport ¬ [],
optimize: BOOL ¬ FALSE,
drawType: DrawType ¬ dashed];
Draw the edges of cube; if optimize, don't draw those edges normally drawn by neighbors.
SimpleCubeFromPairs:
PROC [
context: Context,
pairs: OctantPairs,
cube: Cube ¬ NIL,
drawType: DrawType ¬ dashed];
Draw the edges of cube given its transformed corners;
if cube is non-NIL, optimizes drawing by not drawing edges normally drawn by neighbors.
FaceOnly:
PROC [
context: Context,
cube: Cube,
face: Face,
view: Matrix,
viewport: Viewport ¬ [],
drawType: DrawType ¬ dashed];
Draw the specified face of the cube.
FancyCube:
PROC [
context: Context,
cube: Cube,
view: Matrix,
viewport: Viewport ¬ [],
label: BOOL ¬ TRUE,
markKids: BOOL ¬ FALSE];
Draw the edges of cube with solid lines and the edges of its octants with dashed lines.
If markKids, then place a mark at the center of each of the non-nil kid octants.
FancyCubeFromPairs:
PROC [
context: Context,
pairs: DirectionPairs,
cornerConnect: DrawType ¬ solid,
edgeConnect: DrawType ¬ dashed,
faceConnect: DrawType ¬ dotted,
label: BOOL ¬ TRUE];
Draw the edges of cube with solid lines and the edges of its octants with dashed lines.
Neighbors:
PROC [
context: Context,
neighborhood: Neighborhood,
view: Matrix,
viewport: Viewport ¬ [],
drawType: DrawType ¬ dashed];
Draw the neighborhood, using a primitive (inaccurate) form of hidden line removal.
Labelling
LabelCube:
PROC [
context: Context,
cube: Cube,
direction: Direction,
view: Matrix,
viewport: Viewport ¬ []];
Label the center of cube according to direction.
LabelDirections:
PROC [context: Context, pairs: DirectionPairs];
Label the pairs (8 corners, 6 faces, 1 center, and 12 edges).
LabelOctants:
PROC [context: Context, pairs: OctantPairs];
Label the pairs at the octant corners.