Maintainer | diagrams-discuss@googlegroups.com |
---|
Various two-dimensional shapes.
- hrule :: (PathLike p, V p ~ R2) => Double -> p
- vrule :: (PathLike p, V p ~ R2) => Double -> p
- polygon :: (PathLike p, V p ~ R2) => PolygonOpts -> p
- polygonVertices :: PolygonOpts -> [P2]
- data PolygonOpts = PolygonOpts {
- sides :: Int
- edgeSkip :: Int
- orientation :: PolygonOrientation
- data PolygonOrientation
- unitSquare :: (Transformable p, PathLike p, V p ~ R2) => p
- square :: (PathLike p, Transformable p, V p ~ R2) => Double -> p
- rect :: (PathLike p, Transformable p, V p ~ R2) => Double -> Double -> p
- starPolygon :: (PathLike p, Transformable p, V p ~ R2) => Int -> Int -> p
- eqTriangle :: (PathLike p, Transformable p, V p ~ R2) => p
- roundedRect :: (PathLike p, V p ~ R2) => R2 -> Double -> p
Miscellaneous
hrule :: (PathLike p, V p ~ R2) => Double -> pSource
Create a centered horizontal (L-R) line of the given length.
vrule :: (PathLike p, V p ~ R2) => Double -> pSource
Create a centered vertical (T-B) line of the given length.
General polygons
polygon :: (PathLike p, V p ~ R2) => PolygonOpts -> pSource
Create a closed regular polygon from the given options.
polygonVertices :: PolygonOpts -> [P2]Source
Generate the vertices of a regular polygon from the given options.
data PolygonOpts Source
PolygonOpts | |
|
data PolygonOrientation Source
Determine how a polygon should be oriented.
Special polygons
unitSquare :: (Transformable p, PathLike p, V p ~ R2) => pSource
A sqaure with its center at the origin and sides of length 1, oriented parallel to the axes.
square :: (PathLike p, Transformable p, V p ~ R2) => Double -> pSource
A sqaure with its center at the origin and sides of the given length, oriented parallel to the axes.
rect :: (PathLike p, Transformable p, V p ~ R2) => Double -> Double -> pSource
rect w h
is an axis-aligned rectangle of width w
and height
h
, centered at the origin.
starPolygon :: (PathLike p, Transformable p, V p ~ R2) => Int -> Int -> pSource
starPolygon p q
creates a star polygon, where p
indicates the
number of vertices, and an edge connects every q
th vertex.
eqTriangle :: (PathLike p, Transformable p, V p ~ R2) => pSource
An equilateral triangle, with radius 1 and base parallel to the x-axis.
Other shapes
roundedRect :: (PathLike p, V p ~ R2) => R2 -> Double -> pSource
roundedRect v r
generates a closed trail, or closed path
centered at the origin, of an axis-aligned rectangle with diagonal
v
and circular rounded corners of radius r
. r
must be
between 0
and half the smaller dimension of v
, inclusive; smaller or
larger values of r
will be treated as 0
or half the smaller
dimension of v
, respectively. The trail or path begins with the
right edge and proceeds counterclockwise.