DIRECTORY G2dBasic, G3dBasic, Real; G3dBasicImpl: CEDAR PROGRAM IMPORTS G2dBasic, Real EXPORTS G3dBasic ~ BEGIN NatSequence: TYPE ~ G2dBasic.NatSequence; NatTable: TYPE ~ G3dBasic.NatTable; NatTableRep: TYPE ~ G3dBasic.NatTableRep; Triple: TYPE ~ G2dBasic.Triple; TripleSequence: TYPE ~ G2dBasic.TripleSequence; TripleSequenceRep: TYPE ~ G2dBasic.TripleSequenceRep; BoolSequence: TYPE ~ G3dBasic.BoolSequence; BoolSequenceRep: TYPE ~ G3dBasic.BoolSequenceRep; Surface: TYPE ~ G3dBasic.Surface; SurfaceSequence: TYPE ~ G3dBasic.SurfaceSequence; SurfaceSequenceRep: TYPE ~ G3dBasic.SurfaceSequenceRep; Quad: TYPE ~ G3dBasic.Quad; QuadSequence: TYPE ~ G3dBasic.QuadSequence; QuadSequenceRep: TYPE ~ G3dBasic.QuadSequenceRep; RefSequence: TYPE ~ G3dBasic.RefSequence; RefSequenceRep: TYPE ~ G3dBasic.RefSequenceRep; Segment: TYPE ~ G3dBasic.Segment; SegmentSequence: TYPE ~ G3dBasic.SegmentSequence; SegmentSequenceRep: TYPE ~ G3dBasic.SegmentSequenceRep; TripleSequenceFromList: PUBLIC PROC [triples: LIST OF Triple] RETURNS [s: TripleSequence] ~ { len: NAT ¬ 0; FOR l: LIST OF Triple ¬ triples, l.rest WHILE l # NIL DO len ¬ len+1; ENDLOOP; s ¬ NEW[G3dBasic.TripleSequenceRep[len]]; s.length ¬ len; FOR n: NAT IN [0..s.length ¬ len) DO {s[n] ¬ triples.first; triples ¬ triples.rest}; ENDLOOP; }; CopyBoolSequence: PUBLIC PROC [bools: BoolSequence] RETURNS [BoolSequence] ~ { copy: BoolSequence ¬ NIL; IF bools # NIL THEN { copy ¬ NEW[BoolSequenceRep[bools.length]]; copy.length ¬ bools.length; FOR n: NAT IN [0..bools.length) DO copy[n] ¬ bools[n]; ENDLOOP; }; RETURN[copy]; }; CopyNatTable: PUBLIC PROC [nats: NatTable] RETURNS [NatTable] ~ { copy: NatTable ¬ NIL; IF nats # NIL THEN { copy ¬ NEW[NatTableRep[nats.length]]; copy.length ¬ nats.length; FOR n: NAT IN [0..nats.length) DO copy[n] ¬ nats[n]; ENDLOOP; }; RETURN[copy]; }; CopyTripleSequence: PUBLIC PROC [triples: TripleSequence] RETURNS [TripleSequence] ~ { copy: TripleSequence ¬ NIL; IF triples # NIL THEN { copy ¬ NEW[TripleSequenceRep[triples.length]]; copy.length ¬ triples.length; FOR n: NAT IN [0..triples.length) DO copy[n] ¬ triples[n]; ENDLOOP; }; RETURN[copy]; }; CopyQuadSequence: PUBLIC PROC [quads: QuadSequence] RETURNS [QuadSequence] ~ { copy: QuadSequence ¬ NIL; IF quads # NIL THEN { copy ¬ NEW[QuadSequenceRep[quads.length]]; copy.length ¬ quads.length; FOR n: NAT IN [0..quads.length) DO copy[n] ¬ quads[n]; ENDLOOP; }; RETURN[copy]; }; CopySegmentSequence: PUBLIC PROC [segments: SegmentSequence] RETURNS [SegmentSequence] ~ { copy: SegmentSequence ¬ NIL; IF segments # NIL THEN { copy ¬ NEW[SegmentSequenceRep[segments.length]]; copy.length ¬ segments.length; FOR n: NAT IN [0..segments.length) DO copy[n] ¬ segments[n]; ENDLOOP; }; RETURN[copy]; }; CopySurfaceSequence: PUBLIC PROC [surfaces: SurfaceSequence] RETURNS [SurfaceSequence] ~ { copy: SurfaceSequence ¬ NIL; IF surfaces # NIL THEN { copy ¬ NEW[SurfaceSequenceRep[surfaces.length]]; copy.length ¬ surfaces.length; FOR n: NAT IN [0..surfaces.length) DO s: Surface ¬ surfaces[n]; copy[n] ¬ [s.clientData, G2dBasic.CopyNatSequence[s.vertices]]; ENDLOOP; }; RETURN[copy]; }; CopyRefSequence: PUBLIC PROC [refAnys: RefSequence] RETURNS [RefSequence] ~ { copy: RefSequence ¬ NIL; IF refAnys # NIL THEN { copy ¬ NEW[RefSequenceRep[refAnys.length]]; copy.length ¬ refAnys.length; FOR n: NAT IN [0..refAnys.length) DO copy[n] ¬ refAnys[n]; ENDLOOP; }; RETURN[copy]; }; AddToBoolSequence: PUBLIC PROC [bools: BoolSequence, bool: BOOL] RETURNS [BoolSequence] ~ { IF bools = NIL THEN bools ¬ NEW[BoolSequenceRep[1]]; IF bools.length = bools.maxLength THEN bools ¬ LengthenBoolSequence[bools]; bools[bools.length] ¬ bool; bools.length ¬ bools.length+1; RETURN[bools]; }; AddToNatTable: PUBLIC PROC [nats: NatTable, natSequence: NatSequence] RETURNS [NatTable] ~ { IF nats = NIL THEN nats ¬ NEW[NatTableRep[1]]; IF nats.length = nats.maxLength THEN nats ¬ LengthenNatTable[nats]; nats[nats.length] ¬ natSequence; nats.length ¬ nats.length+1; RETURN[nats]; }; AddToTripleSequence: PUBLIC PROC [triples: TripleSequence, triple: Triple] RETURNS [TripleSequence] ~ { IF triples = NIL THEN triples ¬ NEW[TripleSequenceRep[1]]; IF triples.length = triples.maxLength THEN triples ¬ LengthenTripleSequence[triples]; triples[triples.length] ¬ triple; triples.length ¬ triples.length+1; RETURN[triples]; }; AddToQuadSequence: PUBLIC PROC [quads: QuadSequence, quad: Quad] RETURNS [QuadSequence] ~ { IF quads = NIL THEN quads ¬ NEW[QuadSequenceRep[1]]; IF quads.length = quads.maxLength THEN quads ¬ LengthenQuadSequence[quads]; quads[quads.length] ¬ quad; quads.length ¬ quads.length+1; RETURN[quads]; }; AddToSegmentSequence: PUBLIC PROC [segments: SegmentSequence, segment: Segment] RETURNS [SegmentSequence] ~ { IF segments = NIL THEN segments ¬ NEW[SegmentSequenceRep[1]]; IF segments.length = segments.maxLength THEN segments ¬ LengthenSegmentSequence[segments]; segments[segments.length] ¬ segment; segments.length ¬ segments.length+1; RETURN[segments]; }; AddToSurfaceSequence: PUBLIC PROC [surfaces: SurfaceSequence, surface: Surface] RETURNS [SurfaceSequence] ~ { IF surfaces = NIL THEN surfaces ¬ NEW[SurfaceSequenceRep[1]]; IF surfaces.length = surfaces.maxLength THEN surfaces ¬ LengthenSurfaceSequence[surfaces]; surfaces[surfaces.length] ¬ surface; surfaces.length ¬ surfaces.length+1; RETURN[surfaces]; }; AddToRefSequence: PUBLIC PROC [refs: RefSequence, ref: REF] RETURNS [RefSequence] ~ { IF refs = NIL THEN refs ¬ NEW[RefSequenceRep[1]]; IF refs.length = refs.maxLength THEN refs ¬ LengthenRefSequence[refs]; refs[refs.length] ¬ ref; refs.length ¬ refs.length+1; RETURN[refs]; }; LengthenBoolSequence: PUBLIC PROC [bools: BoolSequence, amount: REAL ¬ 1.3] RETURNS [new: BoolSequence] ~ { newLength: NAT ¬ MAX[Real.Ceiling[amount*bools.maxLength], 3]; new ¬ NEW[BoolSequenceRep[newLength]]; FOR i: NAT IN [0..bools.length) DO new[i] ¬ bools[i]; ENDLOOP; new.length ¬ bools.length; }; LengthenTripleSequence: PUBLIC PROC [triples: TripleSequence, amount: REAL ¬ 1.3] RETURNS [new: TripleSequence] ~ { newLength: NAT ¬ MAX[Real.Ceiling[amount*triples.maxLength], 3]; new ¬ NEW[TripleSequenceRep[newLength]]; FOR i: NAT IN [0..triples.length) DO new[i] ¬ triples[i]; ENDLOOP; new.length ¬ triples.length; }; LengthenNatTable: PUBLIC PROC [nats: NatTable, amount: REAL ¬ 1.3] RETURNS [new: NatTable] ~ { newLength: NAT ¬ MAX[Real.Ceiling[amount*nats.maxLength], 3]; new ¬ NEW[NatTableRep[newLength]]; FOR i: NAT IN [0..nats.length) DO new[i] ¬ nats[i]; ENDLOOP; new.length ¬ nats.length; }; LengthenQuadSequence: PUBLIC PROC [quads: QuadSequence, amount: REAL ¬ 1.3] RETURNS [new: QuadSequence] ~ { newLength: NAT ¬ MAX[Real.Ceiling[amount*quads.maxLength], 3]; new ¬ NEW[QuadSequenceRep[newLength]]; FOR i: NAT IN [0..quads.length) DO new[i] ¬ quads[i]; ENDLOOP; new.length ¬ quads.length; }; LengthenSegmentSequence: PUBLIC PROC [ segments: SegmentSequence, amount: REAL ¬ 1.3] RETURNS [new: SegmentSequence] ~ { newLength: NAT ¬ MAX[Real.Ceiling[amount*segments.maxLength], 3]; new ¬ NEW[SegmentSequenceRep[newLength]]; FOR i: NAT IN [0..segments.length) DO new[i] ¬ segments[i]; ENDLOOP; new.length ¬ segments.length; }; LengthenSurfaceSequence: PUBLIC PROC [ surfaces: SurfaceSequence, amount: REAL ¬ 1.3] RETURNS [new: SurfaceSequence] ~ { newLength: NAT ¬ MAX[Real.Ceiling[amount*surfaces.maxLength], 3]; new ¬ NEW[SurfaceSequenceRep[newLength]]; FOR i: NAT IN [0..surfaces.length) DO new[i] ¬ surfaces[i]; ENDLOOP; new.length ¬ surfaces.length; }; LengthenRefSequence: PUBLIC PROC [refs: RefSequence, amount: REAL ¬ 1.3] RETURNS [new: RefSequence] ~ { newLength: NAT ¬ MAX[Real.Ceiling[amount*refs.maxLength], 3]; new ¬ NEW[RefSequenceRep[newLength]]; FOR i: NAT IN [0..refs.length) DO new[i] ¬ refs[i]; ENDLOOP; new.length ¬ refs.length; }; END. < G3dBasicImpl.mesa Copyright Σ 1984, 1988, 1991, 1992 by Xerox Corporation. All rights reserved. Bloomenthal, July 14, 1992 2:06 pm PDT Heckbert, August 11, 1988 5:18:40 pm PDT Glassner, July 5, 1989 7:02:04 pm PDT Types Sequence Miscellany Sequence Copying Adding to a Sequence Lengthening a Sequence Κ σ•NewlineDelimiter –"cedarcode" style™™Jšœ ΟeœC™NJ™&J™(J™%J˜JšΟk œ˜#J˜—šΠbl œžœž˜Jšžœ˜Jšžœ ˜J˜—Jšœž˜headšΟl™Jšœžœ˜,Jšœ žœ˜'Jšœžœ˜,Jšœ žœ˜#Jšœžœ˜1Jšœžœ˜6Jšœžœ˜-Jšœžœ˜2Jšœ žœ˜%Jšœžœ˜2Jšœžœ˜7Jšœžœ˜ Jšœžœ˜-Jšœžœ˜2Jšœžœ˜,Jšœžœ˜1Jšœ žœ˜%Jšœžœ˜2Jšœžœ˜7—š ™šΟnœž œ žœžœ˜=Jšžœ˜Jšœ˜Jšœžœ˜ Jšžœžœžœžœžœžœžœ˜NJšœžœ"˜)J˜Jš žœžœžœžœ1žœ˜]J˜——š ™š‘œžœžœžœ˜NJšœžœ˜šžœ žœžœ˜Jšœžœ ˜*J˜Jš žœžœžœžœžœ˜?J˜—Jšžœ˜ J˜J˜—š‘ œž œ˜*Jšžœ˜Jšœžœ˜šžœžœžœ˜Jšœžœ˜%J˜Jš žœžœžœžœžœ˜=J˜—Jšžœ˜ J˜J˜—š‘œž œ˜9Jšžœ˜Jšœžœ˜šžœ žœžœ˜Jšœžœ$˜.J˜Jš žœžœžœžœžœ˜CJ˜—Jšžœ˜ J˜J˜—š‘œž œ˜3Jšžœ˜J˜Jšœžœ˜šžœ žœžœ˜Jšœžœ ˜*J˜Jš žœžœžœžœžœ˜?J˜—Jšžœ˜ J˜J˜—š‘œž œ˜Jšœžœ˜&Jš žœžœžœžœžœ˜>J˜J˜J˜—š‘œž œ#žœ˜QJšžœ˜!Jšœ žœžœ,˜@Jšœžœ˜(Jš žœžœžœžœžœ˜BJ˜J˜J˜—š‘œž œžœ˜BJšžœ˜Jšœ žœžœ)˜=Jšœžœ˜"Jš žœžœžœžœžœ˜Jšœžœ˜&Jš žœžœžœžœžœ˜>J˜J˜J˜—š‘œž œ˜&J˜Jšœžœ˜Jšžœ˜J˜Jšœ žœžœ-˜AJšœžœ ˜)Jš žœžœžœžœžœ˜DJ˜J˜J˜—š‘œž œ˜&Jšœ˜Jšœžœ˜Jšžœ˜J˜Jšœ žœžœ-˜AJšœžœ ˜)Jš žœžœžœžœžœ˜DJ˜J˜J˜—š‘œž œžœ˜HJšžœ˜Jšœ žœžœ)˜=Jšœžœ˜%Jš žœžœžœžœžœ˜