SVAssembly.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by Bier on February 24, 1987 2:11:06 pm PST
Contents: Solidviews assemblies are like Gargoyle slices. They draw themselves as a unit. They update their bounding boxes. Their parts can be selected. This module is to Solidviews what GGSlice is to Gargoyle.
DIRECTORY
AtomButtonsTypes, Imager, PriorityQueue, Rope, SV2d, SV3d, SVBasicTypes, SVModelTypes, SVSceneTypes, ViewerClasses;
SVAssembly: CEDAR DEFINITIONS =
BEGIN
Artwork: TYPE = SVModelTypes.Artwork;
Slice: TYPE = SVSceneTypes.Slice;
BoundBox: TYPE = SVBasicTypes.BoundBox;
BoundHedron: TYPE = SVSceneTypes.BoundHedron;
Camera: TYPE = SVModelTypes.Camera;
CoordSystem: TYPE = SVModelTypes.CoordSystem;
FeedbackData: TYPE = AtomButtonsTypes.FeedbackData;
Line3d: TYPE = SV3d.Line3d;
MasterObject: TYPE = SVSceneTypes.MasterObject;
Matrix4by4: TYPE = SV3d.Matrix4by4;
Point2d: TYPE = SV2d.Point2d;
Point3d: TYPE = SV3d.Point3d;
PointAndDone: TYPE = SVSceneTypes.PointAndDone;
PointPairAndDone: TYPE = SVSceneTypes.PointPairAndDone;
PointSetOp: TYPE = SVSceneTypes.PointSetOp; -- {union, intersection, difference}
PointGenerator: TYPE = SVSceneTypes.PointGenerator;
PointPairGenerator: TYPE = SVSceneTypes.PointPairGenerator;
Scene: TYPE = SVSceneTypes.Scene;
SelectionClass: TYPE = SVSceneTypes.SelectionClass;
SelectMode: TYPE = SVSceneTypes.SelectMode;
SliceDescriptor: TYPE = SVSceneTypes.SliceDescriptor;
SliceParts: TYPE = SVSceneTypes.SliceParts;
ToolData: TYPE = SVSceneTypes.ToolData;
Vector3d: TYPE = SV3d.Vector3d;
Viewer: TYPE = ViewerClasses.Viewer;
CreatePrimitive: PROC [name: Rope.ROPE, object: Rope.ROPE, scene: Scene, artwork: Artwork ← NIL, isTool: BOOLFALSE, toolData: ToolData ← NIL] RETURNS [prim: Slice, masterObjectFound: BOOL, success: BOOL];
Create a primitive assembly, based on the master object named object, in scene. Its surface looks are described by artwork. It will look normal to start with (as opposed to as a "Tool" or invisible). If toolData is not provided, a close-fitting tool will be computed when needed.
Object must be on the master object list of scene. Use AddMasterObjectToScene below.
If success is FALSE, a message is written to the message window and nothing is done. The possible reason is that the name is already present.
scene is needed to check uniqueness of names, to provide the coordinate system tree, and to find the master object.
CreatePrimitiveAtExistingCoordSys: PROC [name: Rope.ROPE, object: Rope.ROPE, size: Vector3d, scene: Scene, coordSys: CoordSystem, artwork: Artwork ← NIL, isTool: BOOLFALSE, toolData: ToolData ← NIL] RETURNS [assembly: Slice, masterObjectFound: BOOL];
Text filein creation.
CreateCluster: PROC [name: Rope.ROPE, pointSetOp: PointSetOp ← union, scene: Scene, isTool: BOOLFALSE, toolData: ToolData ← NIL] RETURNS [assembly: Slice, success: BOOL];
Like CreatePrimitive but adds an assembly which can have children (can be passed as "parent" later.
AddCluster: PROC [cluster: Slice, parent: Slice, mat: Matrix4by4, scene: Scene] RETURNS [success: BOOL];
CreateClusterAssemblyAtExistingCoordSys: PUBLIC PROC [name: Rope.ROPE, pointSetOp: PointSetOp, scene: Scene, coordSys: CoordSystem, isTool: BOOLFALSE, toolData: ToolData ← NIL] RETURNS [assembly: Slice];
AddPrimitive: PROC [prim: Slice, size: Vector3d, parent: Slice, mat: Matrix4by4, scene: Scene] RETURNS [success: BOOL];
Add a primitive assembly, based on the master object named object, scaled by size, in scene. Add a primitive assembly as a child of parent, so that assemblyparent will be mat.
AttemptToAddSubassemblyToPrimitive: SIGNAL;
ConnectAssemblyToParent: PROC [assembly: Slice, parent: Slice];
IsComposite: PROC [assem: Slice] RETURNS [BOOL];
Not for general use. Used in conjunction with Create*AtExistingCoordSys to wire up children to parents. Text filein uses this.
Fundamentals
GetHedron: PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
GetBoundBox: PROC [assem: Slice, parts: SliceParts, camera: Camera] RETURNS [bBox: BoundBox];
UpdateBoundBoxForCamera: PROC [assem: Slice, camera: Camera];
A camera has moved. Update the boundbox for this camera.
Drawing
DrawTransform: PROC [sliceD: SliceDescriptor, dc: Imager.Context, scene: Scene, camera: Camera, transform: Matrix4by4];
Draw: PROC [assem: Slice, dc: Imager.Context, scene: Scene, camera: Camera];
DrawParts: PROC [slice: Slice, parts: SliceParts ← NIL, dc: Imager.Context, scene: Scene, camera: Camera, quick: BOOL];
DrawSelectionFeedback: PROC [slice: Slice, selectedParts: SliceParts, hotParts: SliceParts, dc: Imager.Context, camera: Camera, dragInProgress, caretIsMoving, hideHot, quick: BOOL];
DrawAttractorFeedback: PROC [sliceD: SliceDescriptor, selectedParts: SliceParts, dragInProgress: BOOL, dc: Imager.Context, camera: Camera];
AddPolygonsToBuffer: PROC [surfaceQueue: PriorityQueue.Ref, assembly: Slice, camera: Camera];
AddPolygonsToBufferTransform: PROC [surfaceQueue: PriorityQueue.Ref, sliceD: SliceDescriptor, scene: Scene, camera: Camera, transform: Matrix4by4];
DrawBuffer: PROC [dc: Imager.Context, surfaceQueue: PriorityQueue.Ref, scene: Scene, camera: Camera];
Draw an assembly and all of its children.
Transforming
Transform: PROC [sliceD: SliceDescriptor, scene: Scene, transform: Matrix4by4];
Four ways to move an assembly C. If d is NIL, the anchor is assumed to be WORLD.
The three routines suggested in "Pointing and Placing with Homogeneous Coordinates", submitted to Computer Vision, Graphics, and Image Processing:
IncTransf: PROC [c: Slice, scene: Scene, m: Matrix4by4, d: CoordSystem ← NIL, dFixed: BOOLFALSE, cameraList: LIST OF Camera ← NIL];
Incrementally transform C with respect to D by M. If D is a descendent of C, this could result in D moving as well. If this is not desired, set DFixed to TRUE and IncTransf makes sure that D doesn't move.
IncTransfMatrix: PUBLIC PROC [c: Slice, dWorld: Matrix4by4, m: Matrix4by4, cameraList: LIST OF Camera ← NIL];
AbsTransf: PROC [c: Slice, scene: Scene, n: Matrix4by4, d: CoordSystem ← NIL, dFixed: BOOLFALSE, cameraList: LIST OF Camera ← NIL];
Absolutely transform C with respect to D by M. If D is a descendent of C, this could result in D moving as well. If this is not desired, set DFixed to TRUE and AbsTransf makes sure that D doesn't move.
TugTransf: PROC [c: Slice, scene: Scene, tugBoat: CoordSystem, n: Matrix4by4, d: CoordSystem ← NIL, cameraList: LIST OF Camera ← NIL];
Absolutely transforms tugBoat with respect to D and then C with respect to tugBoat.
TugTransfLeaveTug: PROC [c: Slice, scene: Scene, tugBoat: CoordSystem, n: Matrix4by4, d: CoordSystem ← NIL, cameraList: LIST OF Camera ← NIL];
ScalePrimitive: PROC [c: Slice, sx, sy, sz: REAL, cameraList: LIST OF Camera ← NIL];
Like TugTransf, but returns tugBoat to its original location.
Textual Description
Describe: PROC [sliceD: SliceDescriptor] RETURNS [rope: Rope.ROPE];
DescribeHit: PROC [slice: Slice, hitData: REF ANY] RETURNS [rope: Rope.ROPE];
Parts
EmptyParts: PROC [sliceD: SliceDescriptor] RETURNS [BOOL];
NewParts: PROC [slice: Slice, hitData: REF ANY, hitPoint: Point3d, mode: SelectMode] RETURNS [sliceD: SliceDescriptor];
DescriptorFromParts: PROC [slice: Slice, parts: SliceParts] RETURNS [sliceD: SliceDescriptor];
UnionParts: PROC [partsA: SliceDescriptor, partsB: SliceDescriptor] RETURNS [aPlusB: SliceDescriptor];
DifferenceParts: PROC [partsA: SliceDescriptor, partsB: SliceDescriptor] RETURNS [aMinusB: SliceDescriptor];
MovingParts: PROC [slice: Slice, selectedParts: SliceParts] RETURNS [background, overlay, rubber, drag: SliceDescriptor];
AugmentParts: PROC [sliceD: SliceDescriptor, selectClass: SelectionClass] RETURNS [more: SliceDescriptor];
Part Generators
PointsInDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [pointGen: PointGenerator];
NextPoint: PROC [pointGen: PointGenerator] RETURNS [pointAndDone: PointAndDone];
PointPairsInDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [pointPairGen: PointPairGenerator];
NextPointPair: PROC [pointPairGen: PointPairGenerator] RETURNS [pointPairAndDone: PointPairAndDone];
Returns a point in WORLD coordinates.
Hit Testing
ClosestPointToPoint: PROC [sliceD: SliceDescriptor, testPoint: Point3d, t: REAL] RETURNS [bestDist: REAL, pointWorld: Point3d, normalWorld: Vector3d, hitData: REF ANY, success: BOOL];
ClosestPointToLine: PROC [sliceD: SliceDescriptor, cameraPoint: Point2d, line3d: Line3d, t: REAL, camera: Camera] RETURNS [bestDist: REAL, pointWorld: Point3d, normalWorld: Vector3d, hitData: REF ANY, success: BOOL];
ClosestSegmentToPoint: PROC [sliceD: SliceDescriptor, testPoint: Point3d, t: REAL] RETURNS [bestDist: REAL, pointWorld: Point3d, normalWorld: Vector3d, hitData: REF ANY, success: BOOL];
ClosestSegmentToLine: PROC [sliceD: SliceDescriptor, cameraPoint: Point2d, line3d: Line3d, t: REAL, camera: Camera] RETURNS [bestDist: REAL, pointWorld: Point3d, normalWorld: Vector3d, hitData: REF ANY, success: BOOL];
ClosestJointToHitData: PROC [sliceD: SliceDescriptor, worldPt: Point3d, normal: Vector3d, hitData: REF ANY] RETURNS [jointD: SliceDescriptor, jointPos: Point3d, jointNormal: Vector3d];
END.