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

Maintainerdiagrams-discuss@googlegroups.com

Diagrams.TwoD.Shapes

Contents

Description

Various two-dimensional shapes.

Synopsis

Miscellaneous

hrule :: (Backend b R2, Renderable (Path R2) b) => Double -> Diagram b R2Source

Create a centered horizontal line of the given length.

vrule :: (Backend b R2, Renderable (Path R2) b) => Double -> Diagram b R2Source

Create a centered vertical line of the given length.

General polygons

polygon :: (Backend b R2, Renderable (Path R2) b) => PolygonOpts -> Diagram b R2Source

Create a regular polygon from the given options.

polygonPath :: (PathLike p, V p ~ R2) => PolygonOpts -> pSource

Create a closed regular polygonal path from the given options.

polygonVertices :: PolygonOpts -> [P2]Source

Generate the vertices of a regular polygon from the given options.

data PolygonOpts Source

Constructors

PolygonOpts 

Fields

sides :: Int

Number of sides; the default is 5.

edgeSkip :: Int

Create star polygons by setting the edge skip to some number other than 1 (the default). With an edge skip of n, edges will connect every nth vertex.

orientation :: PolygonOrientation

Determine how the polygon should be oriented.

data PolygonOrientation Source

Determine how a polygon should be oriented.

Constructors

NoOrient

No special orientation; one vertex will be at (1,0). This is the default.

OrientToX

Orient so the botommost edge is parallel to the x-axis.

OrientToY

Orient so the leftmost edge is parallel to the y-axis.

Special polygons

square :: (Backend b R2, Renderable (Path R2) b) => Diagram b R2Source

A sqaure with its center at the origin and sides of length 1, oriented parallel to the axes.

starPolygon :: (Backend b R2, Renderable (Path R2) b) => Int -> Int -> Diagram b R2Source

starPolygon p q creates a star polygon, where p indicates the number of vertices, and an edge connects every qth vertex.

eqTriangle :: (Backend b R2, Renderable (Path R2) b) => Diagram b R2Source

An equilateral triangle, with radius 1 and base parallel to the x-axis.