diagrams-lib-0.4: Embedded domain-specific language for declarative graphics

Maintainerdiagrams-discuss@googlegroups.com

Diagrams.TwoD.Shapes

Contents

Description

Various two-dimensional shapes.

Synopsis

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) => 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.