wumpus-basic-0.18.0: Basic objects and system code built on Wumpus-Core.

Portability GHC highly unstable Stephen Tetley

Wumpus.Basic.Geometry.Paths

Description

Path algorithms for elementary shapes - rectangle, diamond, polygon.

Synopsis

# Documentation

data PathAlg u Source

A vector chain building a path.

The vectors are relative to the predecessor, so the rendering of a `PathAlg` iterates the start point.

A polygon PathAlg should have steps for all sides of the polygon with the end point generated by the last vector coinciding with thet start point.

pathStartIsStart :: [Vec2 u] -> PathAlg uSource

Create a PathAlg from the vertex list.

When the PathAlg is run the supplied point will be the start of the path.

pathStartIsLocus :: [Vec2 u] -> PathAlg uSource

Create a PathAlg from the vector list - the first vector displaces the start point the subsequent vectors displace the current tip. Figuratively, this is rather like Logo turtle drawing.

When the PathAlg is run, the supplied point is the locus of the path and it does not form part of the path proper.

This constructor is typically used to make shape paths where the supplied point is the center and the generated path is the border.

pathIterateLocus :: Num u => [Vec2 u] -> PathAlg uSource

Note this creates a path where the first vector represents a `moveto`, then the subsequence vectors represent `linetos`.

Create a PathAlg from the vector list - each vector in the input list iterates to the start point rather then the cumulative tip.

When the PathAlg is run, the supplied point is the locus of the path and it does not form part of the path proper.

Like `pathStartIsLocus`, this constructor is typically used to make shape paths. Some shapes are easier to express as iterated displacements of the center rather than turtle drawing.

rectanglePathAlg :: Fractional u => u -> u -> PathAlg uSource

Implicit start point is center, the genearated moves are counter-clockwise so the move-list is

``` [ moveto_bl, moveto_br, moveto_tr, moveto_tl ]
```

blRectanglePathAlg :: Num u => u -> u -> PathAlg uSource

Implicit start point is bottom-left, subsequent moves are counter-clockwise so the move-list is:

``` [ moveto_br, moveto_tr, moveto_tl, moveto_bl ]
```

diamondPathAlg :: Num u => u -> u -> PathAlg uSource

`diamondPathAlg` : ` half_width * half_height -> PathAlg `

isoscelesTriPathAlg :: Floating u => u -> u -> PathAlg uSource

`isoscelesTriPathAlg` : ` base_width * height -> PathAlg `

Start point is centtroid not incenter.

polygonPathAlg :: Floating u => Int -> u -> PathAlg uSource

`polygonPathAlg` : ` num_points * radius -> PathAlg `

arcPathAlg :: Floating u => u -> Radian -> Radian -> PathAlg uSource

`arcPathAlg` : ` radius * angle1 * angle2 -> PathAlg `

parallelogramPathAlg :: Floating u => u -> u -> Radian -> PathAlg uSource

` width * height * bottom_left_angle`

isoscelesTrapeziumPathAlg :: Floating u => u -> u -> u -> PathAlg uSource

` base_width * top_width * height`