GGObjects.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited by Bier on March 10, 1987 7:08:27 pm PST
Contents: The procedural interface to the Gargoyle object modeler.
Stone, August 5, 1985 1:01:40 pm PDT
Pier, December 11, 1986 3:44:33 pm PST
DIRECTORY
GGBasicTypes, GGInterfaceTypes, GGModelTypes, GGSegmentTypes, Imager, ImagerTransformation, Rope, Rosary;
GGObjects: CEDAR DEFINITIONS = BEGIN
BoundBox: TYPE = GGModelTypes.BoundBox;
Slice: TYPE = GGModelTypes.Slice;
Joint: TYPE = GGModelTypes.Joint;
Outline: TYPE = GGModelTypes.Outline;
Point: TYPE = GGBasicTypes.Point;
Scene: TYPE = GGModelTypes.Scene;
Sequence: TYPE = GGModelTypes.Sequence;
Traj: TYPE = GGModelTypes.Traj;
TrajEnd: TYPE = GGModelTypes.TrajEnd; -- {lo, hi}
Segment: TYPE = GGSegmentTypes.Segment;
Vector: TYPE = GGBasicTypes.Vector;
EntityGenerator: TYPE = GGModelTypes.EntityGenerator;
OutlineGenerator: TYPE = GGModelTypes.OutlineGenerator;
TrajGenerator: TYPE = GGModelTypes.TrajGenerator;
SliceGenerator: TYPE = GGModelTypes.SliceGenerator;
BoundBoxGenerator: TYPE = GGModelTypes.BoundBoxGenerator;
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
fillColor: PUBLIC Imager.Color;
Creating Scenes
CreateScene: PROC [] RETURNS [scene: Scene];
MergeScenes: PROC [back: Scene, front: Scene] RETURNS [combined: Scene];
PushScene: PROC [scene: Scene];
Makes a copy of the current scene list, and pushes it on a stack. For use in Undelete.
EmptySceneStack: PROC [scene: Scene] RETURNS [BOOL];
PopScene: PROC [scene: Scene];
Lets scene be the most recently pushed scene, that has not yet been popped.
Modifying Scenes
AddOutline: PROC [scene: Scene, outline: Outline, priority: INT ← -1];
Add the given outline to the scene with the given priority (the higher the priority number, the closer the outline is to the front of the scene). If priority is -1, the outline will be the front-most entity. If the priority given is too high, we proceed as if priority = -1.
DeleteOutline: PROC [scene: Scene, outline: Outline];
Deletes the whole outline from the scene.
AddSlice: PROC [scene: Scene, slice: Slice, priority: INT ← -1];
Add the given slice to the scene with the given priority (the higher the priority number, the closer the outline is to the front of the scene). If priority is -1, the slice will be the front-most entity. If the priority given is too high, we proceed as if priority = -1.
AddEntities: PROC [scene: Scene, entities: LIST OF REF ANY, priority: INT ← -1];
Adds the entities, assumed to be in back to front order, to the scene. IF priority = -1, they become the frontmost entities. Otherwise, the specified priority becomes the priority of the first entity in the list, if possible. If the priority given is too high, we proceed as if priority = -1.
AddEntity: PROC [scene: Scene, entity: REF ANY, priority: INT ← -1];
Adds the entity to the scene. If priority = 0, it becomes the rearmost entity. IF priority = -1, it becomes the frontmost entity. If the priority given is too high, we proceed as if priority = -1.
EntityPriority: PROC [scene: Scene, entity: REF ANY] RETURNS [priority: INT];
DeleteEntity: PROC [scene: Scene, entity: REF ANY];
Removes the named entity from the scene. If the entity is not on the list, no action is taken.
DeleteSequence: PROC [seq: Sequence, scene: Scene] RETURNS [oldOutline: Outline, newOutlines: LIST OF Outline];
Deletes some parts of an outline from the scene. The result can be multiple outlines if the original outline is broken up into pieces. The effect is as follows:
Takes the trajectory of which seq is a part. What is the role of this trajectory?
If role = hole, then create a new outline (and new trajectories), identical to seq.traj.outline, but without the hole. Make separate outlines corresponding to those parts of the hole which were not deleted. The old outline (and all of its parts) is now obsolete.
If role = fence, then create new outlines and new trajectories for all of the parts of seq.traj.outline which remain. The old outline (and all of its parts) is now obsolete.
If role = open, then create new outlines and new trajectories for all of the parts of seq.traj which remain. The old outline is obsolete.
UpOne: PROC [scene: Scene, entity: REF ANY];
Moves the named entity one step closer to the front in the priority order.
DownOne: PROC [scene: Scene, entity: REF ANY];
Moves the named entity one step closer to the back in the priority order.
Browsing the Scene Hierarchy -- Generators
IsTopLevel: PROC [entity: REF ANY] RETURNS [BOOL];
TopLevelEntitiesInScene: PROC [scene: Scene] RETURNS [entityGenerator: EntityGenerator];
NextEntity: PROC [g: EntityGenerator] RETURNS [next: REF ANY];
EntityCount: PROC [g: EntityGenerator] RETURNS [count: NAT];
Returns the number of entities left in the generator.
SlicesInScene: PROC [scene: Scene] RETURNS [sliceGen: SliceGenerator];
NextSlice: PROC [g: SliceGenerator] RETURNS [next: Slice];
TrajsInScene: PROC [scene: Scene] RETURNS [trajGen: TrajGenerator];
Generates all of the trajectories in the scene, wherever they occur.
NextTraj: PROC [g: TrajGenerator] RETURNS [next: Traj];
OutlinesInScene: PROC [scene: Scene] RETURNS [outlineGen: OutlineGenerator];
NextOutline: PROC [g: OutlineGenerator] RETURNS [next: Outline];
Bounding Boxes
BoundBoxesInScene: PROC [scene: Scene] RETURNS [bBoxGen: BoundBoxGenerator];
The bounding boxes of the top level entities, allowing for control points and stroke widths.
TightBoxesInScene: PROC [scene: Scene] RETURNS [bBoxGen: BoundBoxGenerator];
The bounding boxes of the top level entities, NOT allowing for control points and stroke widths.
NextBox: PROC [g: BoundBoxGenerator] RETURNS [next: BoundBox];
BoundBoxOfScene: PROC [scene: Scene] RETURNS [bBox: BoundBox];
The bounding box of the entire scene, allowing for control points and stroke widths.
TightBoxOfScene: PROC [scene: Scene] RETURNS [bBox: BoundBox];
The bounding box of the entire scene, NOT allowing for control points and stroke widths.
Hit Testing -- Outline-Specific routines. These should go away when Outlines become Slices.
NearestSegmentInScene: PROC [scene: Scene, worldPt: Point, gargoyleData: GargoyleData] RETURNS [traj: Traj, segNum: NAT, isSlice: BOOL];
Searches all of the outlines and slices in the scene. Finds the closest segment. If this segment is part of a slice, isSlice = TRUE and other data is invalid. Otherwise, isSlice = FALSE, and traj, segNum describes the nearest segment.
NearestTrajectoryInScene: PROC [scene: Scene, worldPt: Point, gargoyleData: GargoyleData] RETURNS [traj: Traj];
Searches all of the outlines and slices in the scene. Finds the closest. If this object is a slice, traj = NIL. Otherwise, it is the nearest trajectory.
Selections
SaveSelections: PROC [scene: Scene];
RestoreSelections: PROC [scene: Scene];
GetSelections: PROC [scene: Scene, selectClass: GGSegmentTypes.SelectionClass] RETURNS [selected: LIST OF REF ANY];
END.