DIRECTORY Imager, PadGraphics, Real, RealFns, SV2d, SVLines2d, SVVector2d; PadGraphicsImpl: PROGRAM IMPORTS Imager, Real, RealFns, SVLines2d, SVVector2d EXPORTS PadGraphics = BEGIN Path: TYPE = SV2d.Path; Point2d: TYPE = SV2d.Point2d; Polygon: TYPE = SV2d.Polygon; Vector2d: TYPE = SV2d.Vector2d; squareSide: REAL _ 6.0; globalOutline: Imager.Trajectory; ScreenToPad: PUBLIC PROC [screenPoint: Point2d, origin: Point2d, scalar: REAL _ 1] RETURNS [padPoint: Point2d] = { padPoint[1] _ screenPoint[1] - origin[1]; padPoint[2] _ screenPoint[2] - origin[2]; padPoint _ SVVector2d.Scale[padPoint, 1/scalar]; }; PadToScreen: PUBLIC PROC [padPoint: Point2d, origin: Point2d, scalar: REAL _ 1] RETURNS [screenPoint: Point2d] = { padPoint _ SVVector2d.Scale[padPoint, scalar]; screenPoint[1] _ padPoint[1] + origin[1]; screenPoint[2] _ padPoint[2] + origin[2]; }; MoveTo: PUBLIC PROC [dc: Imager.Context, padPoint: Point2d, origin: Point2d] = { screenPoint: Point2d; screenPoint _ PadToScreen[padPoint, origin]; globalOutline _ Imager.MoveTo[[screenPoint[1], screenPoint[2]]]; }; DrawTo: PUBLIC PROC [dc: Imager.Context, padPoint: Point2d, origin: Point2d] = { screenPoint: Point2d; screenPoint _ PadToScreen[padPoint, origin]; globalOutline _ Imager.LineTo[globalOutline, [screenPoint[1], screenPoint[2]]]; Imager.MaskStroke[dc, globalOutline, 1, square]; }; MirrorMoveTo: PUBLIC PROC [dc: Imager.Context, padPoint: Point2d, origin: Point2d] = { screenPoint: Point2d; padPoint[1] _ -padPoint[1]; screenPoint _ PadToScreen[padPoint, origin]; globalOutline _ Imager.MoveTo[[screenPoint[1], screenPoint[2]]]; }; MirrorDrawTo: PUBLIC PROC [dc: Imager.Context, padPoint: Point2d, origin: Point2d] = { screenPoint: Point2d; padPoint[1] _ -padPoint[1]; screenPoint _ PadToScreen[padPoint, origin]; globalOutline _ Imager.LineTo[globalOutline, [screenPoint[1], screenPoint[2]]]; Imager.MaskStroke[dc, globalOutline, 1, square]; }; DrawPathNeighborHood: PUBLIC PROC [dc: Imager.Context, path: Path, index: NAT, origin: Point2d] = { DrawSquare[dc, squareSide, path[index], origin]; IF index>0 THEN { MoveTo[dc, path[index-1], origin]; DrawTo[dc, path[index], origin]; }; IF index0 THEN { MirrorMoveTo[dc, path[index-1], origin]; MirrorDrawTo[dc, path[index], origin]; }; IF index0, so (1-cos(theta/2) < z/r. -cos(theta/2) < z/r - 1. cos(theta/2) > (1 - z/r). Theta/2 < ArcCos[1 - z/r]. Theta < 2*ArcCos[1 - z/r]. Let z = 0.5. Now find a deltaTheta smaller than this which goes evenly into 45 degrees. Draw three parallel lines, 2 black with 1 white in between so that the total width is three screen dots. This requires that we calculate the points with are 1 unit from the given central line segment and normal to that line segment. Find the left and right segments given the center segment Now draw the left line Now draw the center line Finally, draw the right line Just a private utility used by Circle. Κ y– "cedar" style˜Iheadšœ™Iprocšœ2™2Lšœ1™1Lšœ7™7L˜šΟk ˜ Lšœ˜Lšœ ˜ L˜Lšœ˜L˜L˜ Lšœ ˜ —L˜Lšœ˜Lšœ-˜4Lšœ˜L˜Lš˜˜Lšœ˜Lšœ œ˜Lšœ˜Lšœ œ˜L˜Lšœ˜L˜!L˜—šΟn œœœ;œ˜rLšœ/™/Lšœ)˜)Lšœ)˜)Lšœ0˜0Lšœ˜—šž œœœ8œ˜rLšœ.˜.Lšœ)˜)Lšœ)˜)Lšœ˜—L˜šžœœœ=˜PLšœ˜Lšœ,˜,Lšœ@˜@Lšœ˜—šžœœœ=˜PLšœ˜Lšœ,˜,LšœO˜OLšœ0˜0Lšœ˜—šž œœœ=˜VLšœ˜Lšœ˜Lšœ,˜,Lšœ@˜@Lšœ˜—šž œœœ=˜VLšœ˜Lšœ˜Lšœ,˜,LšœO˜OLšœ0˜0Lšœ˜—L˜šžœœœ)œ˜cLšœO™OLšœ™LšœJ™JLšœ0˜0šœ œ˜Lšœ"˜"Lšœ ˜ Lšœ˜—šœœ˜Lšœ"˜"Lšœ ˜ Lšœ˜—Lšœ˜—šžœœœ)œ˜iLšœO™OLšœ™LšœJ™JLšœ6˜6šœ œ˜Lšœ(˜(Lšœ&˜&Lšœ˜—šœœ˜Lšœ(˜(Lšœ&˜&Lšœ˜—Lšœ˜—šžœ œ,œ˜fLšœO™OLšœ™Lšœ=™=Lšœ'™'Lšœ!˜!Lšœ;˜;Lšœ<˜˜>JšœO˜OJšœ.˜.Jšœ˜—šžœ œ.œ˜M™&Jšœ.˜.Jšœ9˜9Jšœ0˜0Jšœ˜——L˜Lšœ˜—…—(Ξ<£