Interactive3D.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last Edited by: Crow, September 27, 1986 1:30:39 pm PDT
DIRECTORY
Real USING [ LargestNumber ],
Imager USING [ Rectangle ],
ThreeDBasics USING [ Context, ShapeInstance ];
Interactive3D:
CEDAR
DEFINITIONS
~ BEGIN
Basic Types
Context: TYPE ~ ThreeDBasics.Context;
FacingDirection: TYPE ~ {front, back, any};
CloseVertex:
TYPE ~
RECORD[
vtx: NAT,
shape: REF ThreeDBasics.ShapeInstance
];
CloseVertexSequence: TYPE ~ RECORD[ SEQUENCE length: CARDINAL OF CloseVertex ];
Procedures for hit testing
NearbyVertices:
PROC[ context: Context, cursorX, cursorY:
REAL, numberToReturn:
NAT ← 1,
maxDistance:
REAL ← Real.LargestNumber ]
RETURNS[ closeVtx:
REF CloseVertexSequence ];
Returns the closest displayed vertices up to "numberOfVertices" which lie within "maxDistance" (Manhattan distance) of the screen position given by (cursorX, cursorY)
BestPolygon: PROC[ closeVtx: REF CloseVertexSequence,
facingDir: FacingDirection ← front, closest: BOOLEAN ← TRUE ];
Procedures for erasable drawing
PasteOn:
PROC[ context: Context, viewPort: Imager.Rectangle, action:
PROC[Context] ];
Stores pixels underlying viewPort and saves them on context.props to RipOff the area later, if something is already stored on context.props it is RippedOff before action is executed
RipOff:
PROC[ context: Context ];
Undoes the last PasteOn
END.