DIRECTORY SV2d; SVPolygon2d: CEDAR DEFINITIONS = BEGIN Point2d: TYPE = SV2d.Point2d; Polygon: TYPE = REF PolygonObj; PolygonObj: TYPE = SV2d.PolygonObj; Path: TYPE = REF PathObj; PathObj: TYPE = SV2d.PathObj; TrigPolygon: TYPE = REF TrigPolygonObj; TrigPolygonObj: TYPE = SV2d.TrigPolygonObj; CreatePoly: PROC [len: NAT] RETURNS [poly: Polygon]; CopyPoly: PROC [poly: Polygon] RETURNS [copy: Polygon]; CircumHexagon: PROC [r: REAL] RETURNS [hex: Polygon]; ClearPoly: PROC [poly: Polygon]; AddPolyPoint: PROC [poly: Polygon, point: Point2d] RETURNS [polyPlusPoint: Polygon]; PutPolyPoint: PROC [poly: Polygon, index: NAT, point: Point2d] RETURNS [newPoly: Polygon]; IsClockwisePoly: PROC [poly: Polygon] RETURNS [BOOL]; InvertPoly: PROC [poly: Polygon] RETURNS [ylop: Polygon]; InvertPolyInPlace: PROC [poly: Polygon]; PartPolyGetsPartPath: PROC [fromPath: Path, fromStart: NAT, toPoly: Polygon, toStart: NAT, duration: NAT] RETURNS [newPoly: Polygon]; PartPolyGetsPartPoly: PROC [fromPoly: Polygon, fromStart: NAT, toPoly: Polygon, toStart: NAT, duration: NAT] RETURNS [newPoly: Polygon]; PathToPolygon: PROC [path: Path] RETURNS [poly: Polygon]; PolygonToTrigPolygon: PROC [poly: Polygon] RETURNS [trigPoly: TrigPolygon]; CreatePath: PROC [len: NAT] RETURNS [path: Path]; CopyPath: PROC [path: Path] RETURNS [copy: Path]; ClearPath: PROC [path: Path]; AddPathPoint: PROC [path: Path, point: Point2d] RETURNS [pathPlusPoint: Path]; InsertPathPoint: PROC [path: Path, point: Point2d] RETURNS [newPath: Path]; SplicePathPoint: PROC [path: Path, point: Point2d, index: INTEGER] RETURNS [newPath: Path]; AttemptToSplicePastEndOfPath: ERROR; DeletePathPoint: PROC [path: Path, index: NAT] RETURNS [newPath: Path]; PutPathPoint: PROC [path: Path, index: NAT, point: Point2d]; ConcatPath: PROC [path1, path2: Path] RETURNS [cat: Path]; SubPath: PROC [path: Path, lo, hi: NAT] RETURNS [subpath: Path]; SubPathOfPoly: PROC [poly: Polygon, lo, hi: NAT] RETURNS [subpath: Path]; ShiftUpPath: PROC [path: Path, startAt: NAT, by: NAT]; ShiftDownPath: PROC [path: Path, startAt: NAT, by: NAT]; ShiftingDataOffLeftEnd: ERROR; ShiftingDownNonExistentElements: ERROR; PolygonToPath: PROC [poly: Polygon] RETURNS [path: Path]; PartPathGetsPartPath: PROC [fromPath: Path, fromStart: NAT, toPath: Path, toStart: NAT, duration: NAT] RETURNS [newPath: Path]; PointPolyClass: TYPE = {in, on, out}; DifferenceAngles: PROC [c, v: REAL] RETURNS [cMinusV: REAL]; CirclePointInPoly: PROC [point: Point2d, poly: Polygon] RETURNS [class: PointPolyClass]; SquarePointInPoly: PROC [point: Point2d, poly: Polygon] RETURNS [class: PointPolyClass]; BoysePointInPoly: PROC [point: Point2d, poly: Polygon] RETURNS [class: PointPolyClass]; SignedArea: PROC [poly: Polygon] RETURNS [area: REAL]; ClockwisePerimeterAroundUnitSquare: PROC [from, to: Point2d] RETURNS [perim: REAL]; END. >File: SVPolygon2d.mesa Last edited by Bier on June 1, 1984 4:47:15 pm PDT Author: Eric Bier on September 4, 1986 2:55:35 pm PDT Contents: Routines for creating, manipulating, and playing with polygons. Part of the SolidViews package. POLYGONS Creates a hexigon which circumscribes the circle whose center is on the origin and whose radius is r. From clockwise to counter-clockwise or vice-versa toPoly in range [toStart..toStart+duration-1] gets fromPath in range [fromStart..fromStart+duration-1]; toPoly in range [toStart..toStart+duration-1] gets fromPoly in range [fromStart..fromStart+duration-1]; TRIG POLYGONS (a richer [and slower] structure) PATHS (open version of a polygon) startAt the index of the highest element which should be shifted down. Must be greater than zero. toPath in range [toStart..toStart+duration-1] gets fromPath in range [fromStart..fromStart+duration-1]; fromPath gets result. c and v must be angles in the range -180 < theta <= 180. dt will be in the rangle -180< dt <= 180. we always choose the shortest way around the circle from v to c. Κ!– "cedar" style˜Iheadšœ™Iprocšœ2™2Lšœ5™5Lšœk™kL˜šΟk ˜ Lšœ˜—L˜Lšœ œ˜ Lš˜˜Lšœ œ˜Lšœ œœ ˜Lšœ œ˜#Lšœœœ ˜Lšœ œ˜Lšœ œœ˜'Lšœœ˜+L˜—Lšœ™L˜LšΟn œœœœ˜4Lšžœœœ˜7šž œœœœ˜5Lšœe™e—Lšž œœ˜ Lšž œœB˜TLšž œœœ-˜ZL˜Lšžœœœœ˜5šž œœœ˜9Lšœ1™1—Lšžœœ˜(š žœœœœ œ˜…Lšœ2™2Lšœ4™4—š žœœ œœ œ˜ˆLšœ2™2Lšœ4™4—Lšž œœœ˜9L˜Lšœ/™/L˜Lšžœœœ˜KL˜Lšœ!™!L˜Lšž œœœœ˜1Lšžœœœ˜1Lšž œœ˜Lšž œœœ˜NLšžœœœ˜KLšžœœ%œœ˜[Lšœœ˜$Lšžœœœœ˜GLšž œœœ˜