INTERFACE PSPlotMesh; IMPORT PSPlot, LR3x3; TYPE LONG = LONGREAL; NAT = CARDINAL; INT = INTEGER; BOOL = BOOLEAN; Color = PSPlot.Color; TileColorProc = PROCEDURE(x, y: INTEGER): Color; TileDefProc = PROCEDURE(x, y: INTEGER): BOOLEAN; PROCEDURE Square( ps: PSPlot.File; (* Postscript file. *) READONLY g2i: LR3x3.T; (* Grid-to-image transformation. *) READONLY i2g: LR3x3.T; (* Image-to-grid transformation. *) xLo, xHi, yLo, yHi: LONG; (* Clipping rectangle, in image coordinates. *) color: TileColorProc; (* Maps tile indices to colors. *) defined: TileDefProc := NIL; (* Predicate "tile is defined"; NIL is always "yes". *) outlineWidth: REAL := 0.0; (* If positive, outlines the painted area. *) ); (* Adds to "ps" a Postscript picture of a regular square tiling, whose vertices are all integer points of the plane. The mapping between tiling coordinates and image coordinates is the projective map whose matrix is "g2i". The matrix assumes that the homogeneous coordinates of grid points are row vectors with weight in position [0]. The determinant of "g2i" must be positive. The "color" predicate must return the color of a tile, given the grid coordinates of its *lower left corner*. The tile gets plotted only if its *center* lies within the closed rectangle "[xLo..xHi]×[yLo..yHi], and the "defined" predicate returns TRUE. *) END PSPlotMesh.