Maintainer | diagrams-discuss@googlegroups.com |
---|---|

Safe Haskell | Safe-Infered |

Various two-dimensional shapes.

- hrule :: (PathLike p, V p ~ R2) => Double -> p
- vrule :: (PathLike p, V p ~ R2) => Double -> p
- regPoly :: (PathLike p, V p ~ R2) => Int -> Double -> p
- eqTriangle :: (PathLike p, V p ~ R2) => Double -> p
- square :: (PathLike p, Transformable p, V p ~ R2) => Double -> p
- pentagon :: (PathLike p, V p ~ R2) => Double -> p
- hexagon :: (PathLike p, V p ~ R2) => Double -> p
- septagon :: (PathLike p, V p ~ R2) => Double -> p
- octagon :: (PathLike p, V p ~ R2) => Double -> p
- nonagon :: (PathLike p, V p ~ R2) => Double -> p
- decagon :: (PathLike p, V p ~ R2) => Double -> p
- hendecagon :: (PathLike p, V p ~ R2) => Double -> p
- dodecagon :: (PathLike p, V p ~ R2) => Double -> p
- unitSquare :: (PathLike p, V p ~ R2) => p
- rect :: (PathLike p, Transformable p, V p ~ R2) => Double -> Double -> p
- roundedRect :: (PathLike p, V p ~ R2) => Double -> Double -> Double -> p
- data RoundedRectOpts = RoundedRectOpts {}
- roundedRect' :: (PathLike p, V p ~ R2) => Double -> Double -> RoundedRectOpts -> 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.

# Regular polygons

regPoly :: (PathLike p, V p ~ R2) => Int -> Double -> pSource

Create a regular polygon. The first argument is the number of
sides, and the second is the *length* of the sides. (Compare to the
`polygon`

function with a `PolyRegular`

option, which produces
polygons of a given *radius*).

The polygon will be oriented with one edge parallel to the x-axis.

eqTriangle :: (PathLike p, V p ~ R2) => Double -> pSource

An equilateral triangle, with sides of the given length and base parallel to the x-axis.

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.

pentagon :: (PathLike p, V p ~ R2) => Double -> pSource

A regular pentagon, with sides of the given length and base parallel to the x-axis.

hexagon :: (PathLike p, V p ~ R2) => Double -> pSource

A regular hexagon, with sides of the given length and base parallel to the x-axis.

septagon :: (PathLike p, V p ~ R2) => Double -> pSource

A regular septagon, with sides of the given length and base parallel to the x-axis.

octagon :: (PathLike p, V p ~ R2) => Double -> pSource

A regular octagon, with sides of the given length and base parallel to the x-axis.

nonagon :: (PathLike p, V p ~ R2) => Double -> pSource

A regular nonagon, with sides of the given length and base parallel to the x-axis.

decagon :: (PathLike p, V p ~ R2) => Double -> pSource

A regular decagon, with sides of the given length and base parallel to the x-axis.

hendecagon :: (PathLike p, V p ~ R2) => Double -> pSource

A regular hendecagon, with sides of the given length and base parallel to the x-axis.

dodecagon :: (PathLike p, V p ~ R2) => Double -> pSource

A regular dodecagon, with sides of the given length and base parallel to the x-axis.

# Other special polygons

unitSquare :: (PathLike p, V p ~ R2) => pSource

A sqaure with its center at the origin and sides of length 1, 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.

# Other shapes

roundedRect :: (PathLike p, V p ~ R2) => Double -> Double -> Double -> pSource

`roundedRect w h r`

generates a closed trail, or closed path
centered at the origin, of an axis-aligned rectangle with width
`w`

, height `h`

, and circular rounded corners of radius `r`

. If
`r`

is negative the corner will be cut out in a reverse arc. If
the size of `r`

is larger than half the smaller dimension of `w`

and `h`

, then it will be reduced to fit in that range, to prevent
the corners from overlapping. The trail or path begins with the
right edge and proceeds counterclockwise. If you need to specify
a different radius for each corner individually, use
`roundedRect'`

instead.

data RoundedRectOpts Source

roundedRect' :: (PathLike p, V p ~ R2) => Double -> Double -> RoundedRectOpts -> pSource

`roundedRect'`

works like `roundedRect`

but allows you to set the radius of
each corner indivually, using `RoundedRectOpts`

. The default corner radius is 0.
Each radius can also be negative, which results in the curves being reversed
to be inward instead of outward.