Type definitions and convenience functions for Graphics.Rendering.Diagrams, an embedded domain-specific language (EDSL) for creating simple diagrams.
- emptyPath :: Path
- pathFromVertices :: [Point] -> Path
- pathFromVectors :: [Vec] -> Path
- pathToVertices :: Point -> Path -> [Point]
- pathToVectors :: Path -> [Vec]
- pathConcat :: Path -> Path -> Path
- closed :: Path -> Path
- isClosed :: Path -> Bool
- rotPath :: Double -> Path -> Path
- pathSizeAndOffset :: Path -> (Vec, Point)
- renderPath :: PathStyle -> Path -> Render ()
Create an open path from a list of vertices. For example,
pathFromVertices [(1,3), (4,4), (6,5)] describes the path with
two segments which starts at (1,3), has a corner at (4,4), and
ends at (6,5). Note, however, that the vertices themselves are
not significant, only the distances between them. That is,
pathFromVertices [(0,1), (3,2), (5,3)] describes exactly the
Create an open path from a list of edge displacement vectors.
pathFromVectors [(1,1), (3,4)] describes the path
with two segments which first moves one unit in the positive x
and y directions, and then moves three units in the positive x
direction and four in the positive y direction.
Convert a path into a list of vertices, starting with the given vertex.
Convert a path to a list of vectors corresponding to the edges of the path.
Concatenate two open paths into a single open path consisting of the first followed by the second.
Create a closed path (by connecting the first and last points in the path).
Rotate a path by a fraction of a circle.
rotPath d rotates
paths by an angle of
d*2*pi radians. Note that creating a
Diagram from a
curved or some
other such function) and then applying
rotate to it is
different than first applying
rotPath to the
making it into a
Diagram. In the latter case, the bounding box
will be correct, whereas in the former case, the bounding box
will still correspond to the unrotated version of the path.
Compute the size of a bounding box for the given
Path, and the
| offset of the starting vertex from the center.