<> <> <> <> <<>> DIRECTORY GGModelTypes, GGInterfaceTypes, Imager; <> <> <> <<1) Selection. In this case we are not interested in the exact point which GGGravity but only in the name of the object deemed to be close. For selection, the environment consists only of visible objects in the Gargoyle scene.>> <<2) Caret placement. We may wish to place the caret on a visible object or on an interesting alignment line. In this case, we care both about the nearest object (e.g. so we can record a touching relationship) and the new point. The environment will consist both of visible objects and of special alignment lines.>> <<3) Intelligent dragging. For each vertex or edge of the objects being dragged, we can perform the gravity mapping, looking for directions in which to move the draggee. This will require arbitrating between multiple attractions. Otherwise, this is like caret placement.>> <<4) Interactive rotation. Some of the alignments of interest during interactive rotation are point alignments. For these GGGravity works as for intelligent dragging. Also, GGGravity can be used in reverse: The environment can be built from the moving object. The test points are present in the scene.>> <> <> <> <> <> <> <<. A partial ordering on nearness of environment objects is defined this way: pt1 < pt2 if pt1 is closer to testPoint. pt1 < line1 (pt not on line1) if pt1 is closer to testPoint. line1 < line2 if line1 is closer to testPoint. pt1 < line1 (pt on line) if the angle between (pt1, testPoint) and line1 is greater than 45 degrees. Except for the last case, OhWow is the same as StrictDistance. However, this modification means that intersection points are easy to select (as for InnerCircle) and any point on any line can always be selected (as for StrictDistance). Not yet implemented (the other two types seem to be adequate).>> <> <> <<>> GGGravity: CEDAR DEFINITIONS = BEGIN Angle: TYPE = GGModelTypes.Angle; BoundBox: TYPE = GGModelTypes.BoundBox; Camera: TYPE = GGModelTypes.Camera; Circle: TYPE = GGModelTypes.Circle; Edge: TYPE = GGModelTypes.Edge; GargoyleData: TYPE = GGInterfaceTypes.GargoyleData; Line: TYPE = GGModelTypes.Line; Segment: TYPE = GGModelTypes.Segment; Sequence: TYPE = GGModelTypes.Sequence; Traj: TYPE = GGModelTypes.Traj; Point: TYPE = GGModelTypes.Point; Vector: TYPE = GGModelTypes.Vector; CreateObjectBag: PROC [] RETURNS [objectBag: ObjectBag]; ObjectBag: TYPE = REF ObjectBagObj; ObjectBagObj: TYPE = RECORD [ seqs: LIST OF FeatureData, slopeLines: LIST OF FeatureData, symmetryLines: LIST OF FeatureData, radiiCircles: LIST OF FeatureData, distanceLines: LIST OF FeatureData, vectors: LIST OF FeatureData, intersectionPoints: LIST OF FeatureData ]; <> <<>> Map: PROC [testPoint: Point, criticalR: REAL, environ: ObjectBag, gargoyleData: GargoyleData] RETURNS [resultPoint: Point, feature: FeatureData]; StrictDistance: PROC [testPoint: Point, criticalR: REAL, environ: ObjectBag] RETURNS [resultPoint: Point, feature: FeatureData]; InnerCircle: PROC [testPoint: Point, criticalR: REAL, innerR: REAL, environ: ObjectBag] RETURNS [resultPoint: Point, feature: FeatureData]; Sectors: PROC [testPoint: Point, criticalR: REAL, environ: ObjectBag] RETURNS [resultPoint: Point, feature: FeatureData]; <> <<>> FeatureType: TYPE = {sequence, distanceLine, slopeLine, symmetryLine, radiiCircle, intersectionPoint}; ResultFeatureType: TYPE = {joint, segment, distanceLine, slopeLine, symmetryLine, radiiCircle, intersectionPoint}; FeatureData: TYPE = REF FeatureDataObj; FeatureDataObj: TYPE = RECORD [ type: FeatureType, tseq: Sequence, -- may be a whole trajectory line: Line, -- "the" line for slopelines circle: Circle, -- "the" circle for circles line1Feature: FeatureData, -- the first line for an intersection point line2Feature: FeatureData, -- the second line for an intersection point degrees: REAL, seg: Segment, -- the Segment which generated a colinearLine point: Point, -- the data for an intersection point. triggerPoints: LIST OF Point _ NIL, -- the points which trigger a slope line (for instance) resultType: ResultFeatureType, segNum: NAT, -- the joint or segment which was hit (input was type trajectory). jointNum: NAT, -- the joint which was hit (or which generated a slopeLine) traj: Traj, -- the Trajectory whose joint generated a slopeLine visible: BOOL _ FALSE ]; SymmetryType: TYPE = {cyclic, mirror}; SymmetryGroup: TYPE = REF SymmetryGroupObj; SymmetryGroupObj: TYPE = RECORD [ type: SymmetryType, order: NAT ]; <> JointAddSlopeLine: PUBLIC PROC [degrees: REAL, direction: Vector, point: Point, jointNum: NAT, traj: Traj, objectBag: ObjectBag]; JointAddVector: PUBLIC PROC [vector: Vector, point: Point, jointNum: NAT, traj: Traj, objectBag: ObjectBag]; JointAddCircle: PUBLIC PROC [radius: REAL, point: Point, jointNum: NAT, traj: Traj, objectBag: ObjectBag]; JointAddPoint: PUBLIC PROC [point: Point, jointNum: NAT, traj: Traj, objectBag: ObjectBag]; <<>> <> SegmentAddTwoAngleLines: PUBLIC PROC [degrees: REAL, p1, p2: Point, segNum, traj: Traj, objectBag: ObjectBag]; SegmentAddDistanceLines: PUBLIC PROC [distance: REAL, segNum: NAT, traj: Traj, objectBag: ObjectBag]; SegmentAddEdge: PUBLIC PROC [point: Point, jointNum: NAT, traj: Traj, objectBag: ObjectBag]; AddTrajectory: PUBLIC PROC [traj: Traj, objectBag: ObjectBag]; AddSequence: PUBLIC PROC [seq: Sequence, objectBag: ObjectBag]; <<>> <> SymmetryAddLines: PUBLIC PROC [group: SymmetryGroup, entity: REF ANY, objectBag: ObjectBag]; SymmetryAddPoints: PUBLIC PROC [group: SymmetryGroup, entity: REF ANY, objectBag: ObjectBag]; <<>> <> CoordFrameAddPoint: PUBLIC PROC [point: Point, objectBag: ObjectBag]; CoordFrameAddXLine: PUBLIC PROC [xVal: REAL, objectBag: ObjectBag]; CoordFrameAddYLine: PUBLIC PROC [yVal: REAL, objectBag: ObjectBag]; FlushObjectBag: PROC [objectBag: ObjectBag]; <> <> AdjustVisibilityPoint: PROC [testPoint: Point, tolerance: REAL, objectBag: ObjectBag]; AdjustVisibilityBox: PROC [box: BoundBox, tolerance: REAL, objectBag: ObjectBag]; DrawObjectBag: PROC [dc: Imager.Context, objectBag: ObjectBag, camera: Camera, gargoyleData: GargoyleData]; <> DrawObjectBagRegardless: PROC [dc: Imager.Context, objectBag: ObjectBag, camera: Camera, gargoyleData: GargoyleData]; <> END.