DIRECTORY GGBasicTypes, GGCoreTypes, GGModelTypes, GGSegmentTypes, Imager, Rope; GGSequence: CEDAR DEFINITIONS = BEGIN BezierDragRecord: TYPE = GGModelTypes.BezierDragRecord; BoundBox: TYPE = GGCoreTypes.BoundBox; ControlPointGenerator: TYPE = GGModelTypes.ControlPointGenerator; EditConstraints: TYPE = GGModelTypes.EditConstraints; Joint: TYPE = GGModelTypes.Joint; JointGenerator: TYPE = GGModelTypes.JointGenerator; Point: TYPE = GGBasicTypes.Point; PointAndDone: TYPE = GGModelTypes.PointAndDone; PointWalkProc: TYPE = GGModelTypes.PointWalkProc; SegAndIndex: TYPE = RECORD [seg: Segment, index: NAT]; Segment: TYPE = GGSegmentTypes.Segment; SegmentGenerator: TYPE = GGModelTypes.SegmentGenerator; SelectionClass: TYPE = GGSegmentTypes.SelectionClass; SequenceOfReal: TYPE = GGCoreTypes.SequenceOfReal; Slice: TYPE = GGModelTypes.Slice; SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor; SliceParts: TYPE = GGModelTypes.SliceParts; StrokeEnd: TYPE = Imager.StrokeEnd; StrokeJoint: TYPE = Imager.StrokeJoint; Traj: TYPE = GGModelTypes.Traj; TrajData: TYPE = GGModelTypes.TrajData; TrajEnd: TYPE = GGModelTypes.TrajEnd; -- {lo, hi}; TrajParts: TYPE = GGModelTypes.TrajParts; TrajPartType: TYPE = GGModelTypes.TrajPartType; -- {none, joint, controlPoint, segment}; SequenceGenerator: TYPE = REF SequenceGeneratorObj; SequenceGeneratorObj: TYPE = RECORD [ list: LIST OF TrajParts ]; CreateFromSegments: PROC [traj: TrajData, startSeg, endSeg: NAT] RETURNS [seq: TrajParts]; CreateJointToJoint: PROC [traj: TrajData, startJoint, endJoint: NAT] RETURNS [seq: TrajParts]; CreateEmpty: PROC [traj: TrajData] RETURNS [seq: TrajParts]; CreateComplete: PROC [traj: TrajData] RETURNS [seq: TrajParts]; CreateFromJoint: PROC [traj: TrajData, jointNum: NAT] RETURNS [seq: TrajParts]; CreateFromSegment: PROC [traj: TrajData, segNum: NAT] RETURNS [seq: TrajParts]; CreateSimpleFromSegment: PROC [traj: TrajData, segNum: NAT] RETURNS [seq: TrajParts]; CreateFromControlPoint: PROC [traj: TrajData, segNum: NAT, controlPointNum: NAT] RETURNS [seq: TrajParts]; Copy: PROC [seq: TrajParts] RETURNS [copy: TrajParts]; CopyInto: PROC [to: TrajParts, from: TrajParts]; FillInJoints: PROC [seq: TrajParts]; FillInControlPoints: PROC [seq: TrajParts]; TrimSelectedParts: PROC [trimDescriptor: SliceDescriptor, selectedList: LIST OF SliceDescriptor]; TrimSelectedJointSegments: PROC [trimDescriptor: SliceDescriptor, selectedList: LIST OF SliceDescriptor]; TrimSelectedControlPointSegments: PROC [trimDescriptor: SliceDescriptor, selectedList: LIST OF SliceDescriptor]; DDifference: PROC [mutable, negative: SliceDescriptor]; Union: PROC [a, b: SliceDescriptor] RETURNS [union: SliceDescriptor]; Difference: PROC [a, b: SliceDescriptor] RETURNS [aMinusB: SliceDescriptor]; Intersection: PROC [a, b: SliceDescriptor] RETURNS [intersection: SliceDescriptor]; TrajMovingParts: PROC [slice: Slice, parts: SliceParts, editConstraints: EditConstraints, bezierDrag: BezierDragRecord] RETURNS [background, overlay, rubber, drag: TrajParts]; Augment: PROC [descriptor: SliceDescriptor, trajEnd: TrajEnd, extend: BOOL] RETURNS [bigger: TrajParts]; IsEmpty: PROC [seq: TrajParts] RETURNS [BOOL]; IsComplete: PROC [seq: TrajParts] RETURNS [BOOL]; IsConstrained: PUBLIC PROC [descriptor: SliceDescriptor, segNum, cPNum: NAT, editConstraints: EditConstraints] RETURNS [BOOL]; Overlap: PROC [descriptor1, descriptor2: SliceDescriptor] RETURNS [BOOL]; ContainsJoint: PROC [seq: TrajParts, jointNum: NAT] RETURNS [BOOL]; ContainsSegment: PROC [seq: TrajParts, segNum: NAT] RETURNS [BOOL]; ContainsSomeSegment: PROC [seq: TrajParts] RETURNS [BOOL]; ContainsSegmentParts: PROC [seq: TrajParts, segNum: NAT] RETURNS [BOOL]; LastSegAndJoint: PROC [traj: TrajData, trajEnd: TrajEnd] RETURNS [segAndJoint: TrajParts]; UnpackOnePointSequence: PROC [seq: TrajParts] RETURNS [isACP: BOOL, segNum, cpNum, jointNum: NAT]; UnpackOneSegmentSequence: PROC [seq: TrajParts] RETURNS [segNum: NAT]; UnpackSimpleSequence: PROC [slice: Slice, parts: SliceParts] RETURNS [success: BOOL, partType: TrajPartType _ none, traj: TrajData, joint: Joint _ NIL, jointNum: NAT _ 999, cp: Point _ [0,0], cpNum: NAT _ 999, seg: Segment _ NIL, segNum: NAT _ 999]; RunsInSequence: PROC [seq: TrajParts] RETURNS [seqGen: SequenceGenerator, runCount: NAT]; NextSequence: PROC [seqGen: SequenceGenerator] RETURNS [seq: TrajParts]; FirstRun: PROC [seq: TrajParts] RETURNS [runParts: TrajParts]; SegmentWalkProc: TYPE = PROC [traj: TrajData, seg: Segment, index: NAT] RETURNS [done: BOOL _ FALSE]; SegmentsInTraj: PROC [traj: TrajData] RETURNS [segGen: SegmentGenerator]; WalkSegmentsInTraj: PROC [traj: TrajData, walkProc: SegmentWalkProc] RETURNS [aborted: BOOL _ FALSE]; SegmentsInSequence: PROC [traj: TrajData, seq: TrajParts] RETURNS [segGen: SegmentGenerator]; WalkSegmentsInSequence: PROC [traj: TrajData, seq: TrajParts, walkProc: SegmentWalkProc] RETURNS [aborted: BOOL _ FALSE]; CountSegmentsInSequence: PROC [traj: TrajData, seq: TrajParts] RETURNS [count: NAT]; OrderedSegmentsInSequence: PROC [traj: TrajData, seq: TrajParts] RETURNS [segGen: SegmentGenerator]; NextSegment: PROC [segGen: SegmentGenerator] RETURNS [next: Segment]; NextSegmentAndIndex: PROC [segGen: SegmentGenerator] RETURNS [next: SegAndIndex]; ControlPointsInSequence: PROC [traj: TrajData, seq: TrajParts] RETURNS [cpGen: ControlPointGenerator]; WalkControlPointsInSequence: PROC [traj: TrajData, seq: TrajParts, walkProc: PointWalkProc]; NextControlPoint: PROC [cpGen: ControlPointGenerator] RETURNS [next: PointAndDone]; NextSegNumAndCPNum: PROC [cpGen: ControlPointGenerator] RETURNS [segNum, cpNum: NAT, done: BOOL]; NextSegmentAndControlPointNum: PROC [cpGen: ControlPointGenerator] RETURNS [segAndCPNum: SegAndIndex]; JointsInSequence: PROC [seq: TrajParts] RETURNS [jointGen: JointGenerator]; WalkJointsInSequence: PROC [traj: TrajData, seq: TrajParts, walkProc: PointWalkProc]; JointWalkProc: TYPE = PROC [traj: TrajData, jointPos: Point, index: NAT] RETURNS [done: BOOL _ FALSE]; WalkJointPositionsInSequence: PROC [traj: TrajData, seq: TrajParts, walkProc: JointWalkProc]; JointsInTraj: PROC [traj: TrajData] RETURNS [jointGen: JointGenerator]; FirstJointNum: PROC [run: TrajParts] RETURNS [INT]; LastJointNum: PROC [run: TrajParts, firstJointNum: INT] RETURNS [lastNum: INT]; FirstSegNum: PROC [run: TrajParts] RETURNS [INT]; LastSegNum: PROC [run: TrajParts, firstSegNum: INT] RETURNS [lastNum: INT]; NextJoint: PROC [jointGen: JointGenerator] RETURNS [next: INT]; END. rGGSequence.mesa Copyright Σ 1986, 1987 by Xerox Corporation. All rights reserved. Last edited by Bier on July 16, 1987 1:42:44 pm PDT Contents: Sequences are a way to describe some part of a trajectory without actually pulling the trajectory apart. The new definition of sequence is that it is ANY subset of the parts of a trajectory (joints and/or segments). Procedures are provided which make sequences, perform boolean operations on them, and step through them. Pier, December 16, 1987 12:08:37 pm PST Eisenman, October 2, 1987 6:26:21 pm PDT Bier, November 4, 1988 11:05:32 pm PST The sequence created will include all of the segments from startSeg to endSeg inclusive, and all of the joints which they touch. startSeg and endSeg must be legal TrajParts numbers for this trajectory. If the trajectory is closed, then startSeg > endSeg is allowed, in which case the segment sequence wraps around. If startSeg = endSeg, then one segment is added. If startSeg = endSeg + 1 (modulo the number of segments in traj), then the whole trajectory is selected. Returns a sequences with only one contiguous part [start...end]. IF the traj is open, then include all segments in the interval [startJoint..endJoint]. If the traj is closed, there are three cases: 1) IF startJoint = endJoint then select a single joint. 2) IF startJoint < endJoint then proceed as for an open traj (but there is no way to include the whole trajectory. 3) IF endJoint < startJoint, wrap around, selecting all segments above startJoint, all segments below endJoint, all joints above startJoint including startJoint, all joints below endJoint, including endJoint. Returns a sequence belonging to traj, which refers to none of its parts. Returns a sequence belonging to traj, which refers to a single joint. Returns a sequence belonging to traj, which refers to a single segment (and the joints at its endpoints). Procedures which mutate Segments (use with caution) Returns a sequence belonging to traj, which refers to all of its parts. Ensures that, for each segment A in seq, both endjoints of A are in seq as well. Ensures that, for each segment A in seq, all control points of A are in seq as well. Modifies, mutes, and munges seq, so that it no longer includes any parts mentioned in selectedList. Used by GGAlign.RemoveMoving. Modifies, mutes, and munges seq, so that it no longer includes any segments whose joints are mentioned in selectedList. Used by GGAlign.RemoveMoving. Modifies, mutes, and munges seq, so that it no longer includes any segments whose control points are mentioned in selectedList. Used by GGAlign.RemoveMoving. This is a destructive form of the Difference operation. mutable _ mutable - negative. Parts Routines Queries IsObsolete: PROC [seq: TrajParts] RETURNS [BOOL]; TRUE if trajectory has changed size (number of joints, segments, or control points) since seq was made. TRUE if the seq represents none of the joints, segments, and control points of its trajectory. TRUE if the seq represents all of the joints, segments, and control points of its trajectory. Tells if a joint is constrained. RETURNS TRUE iff descriptor1 and descriptor2 share some joints or segments. Returns TRUE if the sequence contains the segment itself. Returns TRUE if the sequence contains any part of a segment, including its end joints, its control points, or the segment proper. seq is asserted to be either a single joint or a single control point. Return the [segNum, cpNum] pair or the jointNum as appropriate. seq is asserted to be a single segment. Return the segNum. Generators A run is a sequence with only one contiguous piece. In other words, each joint in the run touches at least one segment in the run (unless the run is a single joint), and each segment in the run touches at least one joint in the run (unless the run is a single segment). The run whose lowest joint has the lowest index will be returned first by NextSequence. The other runs will follow in ascending order. Returns a generator for all segment in traj, beginning with segment 0. Calls walkProc for each segment in traj, until walkProc returns done=TRUE. Returns a generator for all segments in seq, beginning with the lowest numbered one (contrast this with OrderedSegmentsInSequence below). Calls walkProc for each segment mentioned in seq, until walkProc returns done=TRUE. Returns a generator for all segment in seq, beginning with the lowest numbered one (in the case of open trajectories), or the first segment that follows a segment that is not in seq (for closed trajectories). If seq.traj is complete and closed, then behaves like SegmentsInSequence. Returns the next segment from segGen. segGen may have been produced by SegmentsInTraj, SegmentsInSequence or OrderedSegmentsInSequence. Calls walkProc on each joint position in seq until walkProc returns done=TRUE. run had better be a run (a single non-empty contiguous sequence). Returns -1 if there are no joints in the run. run had better be a run (a single non-empty contiguous sequence). run had better be a run (a single non-empty contiguous sequence). Returns -1 if there are no joints in the run. Note that FirstJointNum[run] and LastJointNum[run] can be the same. Κ9˜Icodešœ™šœB™BKšœ3™3šΟnœšΟkœ¨™ΝKšœ'™'K™(—K™&—K™šž ˜ KšœF˜F—K˜š œžœž œž˜%K˜Kšœžœ!˜7Kšœ žœ˜&Kšœžœ&˜AKšœžœ ˜5Kšœžœ˜!Kšœžœ˜3Kšœžœ˜!Kšœžœ˜/Kšœžœ˜1Kšœ žœžœžœ˜6Kšœ žœ˜'Kšœžœ!˜7Kšœžœ!˜5Kšœžœ˜2Kšœžœ˜!Kšœžœ ˜5Kšœ žœ˜+Kšœ žœ˜#Kšœ žœ˜'Kšœžœ˜Kšœ žœ˜'Kšœ žœΟc ˜2Kšœ žœ˜)KšœžœŸ(˜XK˜Kšœžœžœ˜3šœžœžœ˜%Kšœžœžœ ˜K˜—K˜—K˜šœžœ$žœžœ˜ZKšœΌ™ΌKšœ0™0Kšœh™hK™@—šœžœ(žœžœ˜^Kšžœ‰žœ8žœsžœΛ™‡—š œžœžœ˜K˜Kš œžœžœ'žœžœžœžœ˜ešœžœžœ˜IK™F—š œžœ-žœ žœžœ˜eKšœEžœ™JK™—šœžœ"žœ˜]Kšœ‰™‰—Kš œžœ=žœ žœžœ˜yšœžœ"žœ žœ˜TKšœS™S—K˜šœžœ"žœ˜dKšœ›™›—š œžœžœ˜EKšœˆ™ˆ—Kšœžœžœ˜QK˜Kšœžœ"žœ ˜fKšœžœ;˜\Kšœžœ žœ˜SKš œžœ žœžœžœ˜aKšœžœ žœ˜fK˜Kšœžœžœ˜KKšœžœ;˜UKš œžœžœ*žœžœžœžœ˜fšœžœ;˜]KšœN™N—Kš œžœžœ˜Gš œžœžœžœ˜3K™p—Kš  œžœ!žœžœ žœ˜Oš œžœžœžœ˜1K™A—š  œžœžœžœ žœ˜KKšœ΄™΄—Kš œžœžœžœ˜?K˜Kšžœ˜J˜—…—n6