DIRECTORY GGBasicTypes, GGModelTypes, GGSegmentTypes; GGSequence: CEDAR DEFINITIONS = BEGIN BoundBox: TYPE = GGBasicTypes.BoundBox; PointAndDone: TYPE = GGModelTypes.PointAndDone; Sequence: TYPE = GGModelTypes.Sequence; Traj: TYPE = GGModelTypes.Traj; Segment: TYPE = GGSegmentTypes.Segment; Joint: TYPE = GGModelTypes.Joint; Point: TYPE = GGBasicTypes.Point; TrajEnd: TYPE = GGModelTypes.TrajEnd; -- {lo, hi}; TrajPartType: TYPE = GGModelTypes.TrajPartType; -- {none, joint, controlPoint, segment}; CreateFromSegments: PROC [traj: Traj, startSeg, endSeg: NAT] RETURNS [seq: Sequence]; CreateJointToJoint: PROC [traj: Traj, startJoint, endJoint: NAT] RETURNS [seq: Sequence]; CreateEmpty: PROC [traj: Traj] RETURNS [seq: Sequence]; CreateComplete: PROC [traj: Traj] RETURNS [seq: Sequence]; Copy: PROC [seq: Sequence] RETURNS [copy: Sequence]; CreateFromJoint: PROC [traj: Traj, jointNum: NAT] RETURNS [seq: Sequence]; CreateFromSegment: PROC [traj: Traj, segNum: NAT] RETURNS [seq: Sequence]; CreateSimpleFromSegment: PROC [traj: Traj, segNum: NAT] RETURNS [seq: Sequence]; CreateFromControlPoint: PROC [traj: Traj, segNum: NAT, controlPointNum: NAT] RETURNS [seq: Sequence]; Augment: PROC [seq: Sequence, trajEnd: TrajEnd, extend: BOOL] RETURNS [bigger: Sequence]; UpdateBoundBox: PROC [seq: Sequence]; ComputeBoundBox: PROC [seq: Sequence] RETURNS [box: BoundBox]; ComputeTightBox: PROC [seq: Sequence] RETURNS [box: BoundBox]; CopyInto: PROC [to: Sequence, from: Sequence]; FillInJoints: PROC [seq: Sequence]; FillInControlPoints: PROC [seq: Sequence]; TrimSelectedParts: PROC [seq: Sequence, selectedList: LIST OF REF ANY]; TrimSelectedControlPointSegments: PROC [seq: Sequence, selectedList: LIST OF REF ANY]; TrimSelectedJointSegments: PROC [seq: Sequence, selectedList: LIST OF REF ANY]; TrimDanglingSegments: PROC [seq: Sequence]; TrimControlPointSegments: PROC [seq: Sequence, controlPointOn: BOOL]; TrimJointSegments: PROC [seq: Sequence, jointOn: BOOL]; DDifference: PROC [mutable, negative: Sequence]; Union: PROC [a, b: Sequence] RETURNS [union: Sequence]; Intersection: PROC [a, b: Sequence] RETURNS [intersection: Sequence]; Difference: PROC [a, b: Sequence] RETURNS [aMinusB: Sequence]; IsEmpty: PROC [seq: Sequence] RETURNS [BOOL]; IsComplete: PROC [seq: Sequence] RETURNS [BOOL]; IsObsolete: PROC [seq: Sequence] RETURNS [BOOL]; Overlap: PROC [seq1, seq2: Sequence] RETURNS [BOOL]; ContainsJoint: PROC [seq: Sequence, jointNum: NAT] RETURNS [BOOL]; ContainsSegment: PROC [seq: Sequence, segNum: NAT] RETURNS [BOOL]; ContainsSegmentParts: PROC [seq: Sequence, segNum: NAT] RETURNS [BOOL]; LastSegAndJoint: PROC [traj: Traj, trajEnd: TrajEnd] RETURNS [segAndJoint: Sequence]; UnpackOnePointSequence: PROC [seq: Sequence] RETURNS [isACP: BOOL, segNum, cpNum, jointNum: NAT]; UnpackOneSegmentSequence: PROC [seq: Sequence] RETURNS [segNum: NAT]; UnpackSimpleSequence: PROC [seq: Sequence] RETURNS [success: BOOL, partType: TrajPartType _ none, traj: Traj, joint: Joint _ NIL, jointNum: NAT _ 999, cp: Point _ [0,0], cpNum: NAT _ 999, seg: Segment _ NIL, segNum: NAT _ 999]; SequenceGenerator: TYPE = GGModelTypes.SequenceGenerator; RunsInSequence: PROC [seq: Sequence] RETURNS [seqGen: SequenceGenerator, runCount: NAT]; NextSequence: PROC [seqGen: SequenceGenerator] RETURNS [seq: Sequence]; SegmentGenerator: TYPE = GGModelTypes.SegmentGenerator; SegmentsInTraj: PROC [traj: Traj] RETURNS [segGen: SegmentGenerator]; SegmentsInSequence: PROC [seq: Sequence] RETURNS [segGen: SegmentGenerator]; OrderedSegmentsInSequence: PROC [seq: Sequence] RETURNS [segGen: SegmentGenerator]; NextSegment: PROC [segGen: SegmentGenerator] RETURNS [next: Segment]; SegAndIndex: TYPE = RECORD [seg: Segment, index: NAT]; NextSegmentAndIndex: PROC [segGen: SegmentGenerator] RETURNS [next: SegAndIndex]; ControlPointGenerator: TYPE = GGModelTypes.ControlPointGenerator; ControlPointsInSequence: PROC [seq: Sequence] RETURNS [cpGen: ControlPointGenerator]; NextControlPoint: PROC [cpGen: ControlPointGenerator] RETURNS [next: PointAndDone]; NextSegNumAndCPNum: PROC [cpGen: ControlPointGenerator] RETURNS [segNum, cpNum: NAT, done: BOOL]; NextSegmentAndControlPointNum: PROC [cpGen: ControlPointGenerator] RETURNS [segAndCPNum: SegAndIndex]; JointGenerator: TYPE = GGModelTypes.JointGenerator; JointsInSequence: PROC [seq: Sequence] RETURNS [jointGen: JointGenerator]; JointsInTraj: PROC [traj: Traj] RETURNS [jointGen: JointGenerator]; FirstJointNum: PROC [run: Sequence] RETURNS [INT]; LastJointNum: PROC [run: Sequence, firstJointNum: INT] RETURNS [lastNum: INT]; FirstSegNum: PROC [run: Sequence] RETURNS [INT]; LastSegNum: PROC [run: Sequence, firstSegNum: INT] RETURNS [lastNum: INT]; NextJoint: PROC [jointGen: JointGenerator] RETURNS [next: INT]; SetStrokeWidth: PROC [seq: Sequence, strokeWidth: REAL]; GetStrokeWidth: PROC [seq: Sequence] RETURNS [strokeWidth: REAL]; END. LGGSequence.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Last edited by Bier on January 14, 1987 5:51:12 pm PST 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, January 15, 1987 1:28:06 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 Sequence 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). Bounding Box Compute the bounding box of all segments, joints, and control points mentioned in seq. Allow for control point size and stroke width. Compute the bounding box of all segments in seq. Do NOT allow for control point size and stroke width. 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 control points are 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. For all runs in seq, if either end of the run is a segment (not a joint), remove that segment. If controlPointOn then remove segments with included control points. Otherwise, remove segments without included control points. If jointOn then for all segments in seq, remove those that have a joint mentioned in seq. Otherwise, remove those segments that do NOT have a joint mentioned. This is a destructive form of the Difference operation. mutable _ mutable - negative. Boolean Operations Queries 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. TRUE if trajectory has changed size (number of joints, segments, or control points) since seq was made. RETURNS TRUE iff seq1 and seq2 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. Returns a generator for all segment in seq, beginning with the lowest numbered one (contrast this with OrderedSegmentsInSequence below). 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. 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. Κ ˜Icodešœ™Kšœ Οmœ1™K™†—š œžœžœ˜>K™g—K˜K™3K™š œžœ ˜.KšœG™G—š  œžœ˜#K™Q—š œžœ˜*K™T—š  œžœΟbΠbk‘’‘’‘’œ˜GKšœm‘œ™‚—š   œžœ‘’‘’‘’‘’œ˜VKšœ‰‘œ™ž—š  œžœ‘’‘’‘’‘’œ˜OKšœ‘œ™–—K˜š œžœ˜+K™^—š œžœ!žœ˜EKšœ™—š œžœžœ˜7KšœŸ™Ÿ—š  œžœ˜0KšœV™VK˜—K˜K™K™Kš œžœžœ˜7Kš  œžœžœ˜EKš  œžœžœ˜>K˜K™K™š œžœžœžœ˜-K™^—š  œžœžœžœ˜0K™]—š  œžœžœžœ˜0K™g—š œžœžœžœ˜4Kšœ=™=—Kš   œžœžœžœžœ˜Bš  œžœžœžœžœ˜BK™9—š  œžœžœžœžœ˜GK™—Kš œžœ žœ˜Uš  œžœžœ žœžœ˜aKšœ‡™‡—Kš œžœžœ žœ˜Eš œžœžœ žœ<žœ žœ"žœžœ žœ˜γKšœ;™;—K˜K™ K™Kšœžœ"˜9š œžœžœ'žœ˜XKšœ˜™˜—Kš  œžœžœ˜GK˜Kšœžœ!˜7K˜š œžœžœ˜EK™F—š œžœžœ˜LKšœˆ™ˆ—š œžœžœ˜SKšœ›™›—š  œžœžœ˜EKšœˆ™ˆ—Kšœ žœžœžœ˜6Kš œžœžœ˜QK˜K˜Kšœžœ&˜AK˜Kš œžœžœ ˜UKš œžœ žœ˜SKš  œžœ žœžœžœ˜aKš œžœ žœ˜fK˜Kšœžœ˜3K˜Kš œžœžœ˜JKš  œžœžœ˜Cš  œžœžœžœ˜2K™p—Kš   œžœ žœžœ žœ˜Nš  œžœžœžœ˜0K™A—š   œžœžœžœ žœ˜JKšœ΄™΄—K˜Kš  œžœžœžœ˜?K˜Kš œžœžœ˜8KšΠbnœžœžœžœ˜AK˜Kšžœ˜J˜—…—(/}