Maintainer  diagramsdiscuss@googlegroups.com 

Safe Haskell  None 
This module defines a general API for creating various types of polygons.
 data PolyType
 data PolyOrientation
 data PolygonOpts = PolygonOpts {}
 polygon :: (TrailLike t, V t ~ R2) => PolygonOpts > t
 polyTrail :: PolygonOpts > Located (Trail R2)
 polyPolarTrail :: Angle a => [a] > [Double] > Located (Trail R2)
 polySidesTrail :: Angle a => [a] > [Double] > Located (Trail R2)
 polyRegularTrail :: Int > Double > Located (Trail R2)
 orient :: R2 > Located (Trail R2) > T2
 data StarOpts
 star :: StarOpts > [P2] > Path R2
 data GraphPart a
 orbits :: (Int > Int) > Int > [GraphPart Int]
 mkGraph :: (Int > Int) > [a] > [GraphPart a]
Polygons
Method used to determine the vertices of a polygon.
forall a . Angle a => PolyPolar [a] [Double]  A "polar" polygon.
To construct an ngon, use a list of n1 angles and n radii. Extra angles or radii are ignored. Cyclic polygons (with all vertices lying on a
circle) can be constructed using a second
argument of 
forall a . Angle a => PolySides [a] [Double]  A polygon determined by the distance between successive vertices and the angles formed by each three successive vertices. In other words, a polygon specified by "turtle graphics": go straight ahead x1 units; turn by angle a1; go straght ahead x2 units; turn by angle a2; etc. The polygon will be centered at the centroid of its vertices.
To construct an ngon, use a list of n2 angles and n1 edge lengths. Extra angles or lengths are ignored. 
PolyRegular Int Double  A regular polygon with the given number of sides (first argument) and the given radius (second argument). 
data PolyOrientation Source
Determine how a polygon should be oriented.
NoOrient  No special orientation; the first vertex will be at (1,0). This is the default. 
OrientH  Orient horizontally, so the bottommost edge is parallel to the xaxis. 
OrientV  Orient vertically, so the leftmost edge is parallel to the yaxis. 
OrientTo R2  Orient so some edge is facing in the direction of, that is, perpendicular to, the given vector. 
data PolygonOpts Source
Options for specifying a polygon.
PolygonOpts  

Default PolygonOpts  The default polygon is a regular pentagon of radius 1, centered at the origin, aligned to the xaxis. 
polygon :: (TrailLike t, V t ~ R2) => PolygonOpts > tSource
Generate the polygon described by the given options.
polyTrail :: PolygonOpts > Located (Trail R2)Source
Generate a polygon. See PolygonOpts
for more information.
Generating polygon vertices
polyPolarTrail :: Angle a => [a] > [Double] > Located (Trail R2)Source
Generate the located trail of a polygon specified by polar data
(central angles and radii). See PolyPolar
.
polySidesTrail :: Angle a => [a] > [Double] > Located (Trail R2)Source
Generate the vertices of a polygon specified by side length and
angles, and a starting point for the trail such that the origin
is at the centroid of the vertices. See PolySides
.
polyRegularTrail :: Int > Double > Located (Trail R2)Source
Generate the vertices of a regular polygon. See PolyRegular
.
orient :: R2 > Located (Trail R2) > T2Source
Generate a transformation to orient a trail. orient v t
generates the smallest rotation such that one of the segments
adjacent to the vertex furthest in the direction of v
is
perpendicular to v
.
Star polygons
Options for creating "star" polygons, where the edges connect possibly nonadjacent vertices.
StarFun (Int > Int)  Specify the order in which the vertices should be connected by a function that maps each vertex index to the index of the vertex that should come next. Indexing of vertices begins at 0. 
StarSkip Int  Specify a star polygon by a "skip". A skip of 1 indicates a normal polygon, where edges go between successive vertices. A skip of 2 means that edges will connect every second vertex, skipping one in between. Generally, a skip of n means that edges will connect every nth vertex. 
star :: StarOpts > [P2] > Path R2Source
Create a generalized star polygon. The StarOpts
are used
to determine in which order the given vertices should be
connected. The intention is that the second argument of type
[P2]
could be generated by a call to polygon
, regPoly
, or
the like, since a list of vertices is TrailLike
. But of course
the list can be generated any way you like. A
is
returned (instead of any Path
R2
TrailLike
) because the resulting path
may have more than one component, for example if the vertices are
to be connected in several disjoint cycles.
Function graphs
These functions are used to implement star
, but are exported on
the offchance that someone else finds them useful.
Pieces of a function graph can either be cycles or "hairs".