Portability | portable |
---|---|
Stability | experimental |
Maintainer | byorgey@gmail.com |
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 ()
Documentation
pathFromVertices :: [Point] -> PathSource
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
same path.
pathFromVectors :: [Vec] -> PathSource
Create an open path from a list of edge displacement vectors.
For example, 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.
pathToVertices :: Point -> Path -> [Point]Source
Convert a path into a list of vertices, starting with the given vertex.
pathToVectors :: Path -> [Vec]Source
Convert a path to a list of vectors corresponding to the edges of the path.
pathConcat :: Path -> Path -> PathSource
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).
rotPath :: Double -> Path -> PathSource
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 Path
(using straight
or curved
or some
other such function) and then applying rotate
to it is
different than first applying rotPath
to the Path
before
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.