Portability | GHC |
---|---|

Stability | highly unstable |

Maintainer | stephen.tetley@gmail.com |

Safe Haskell | Safe-Infered |

*Trails* - prototype paths. Less resource heavy than the Path
object in Wumpus-Drawing.

`CatTrail`

supports concatenation. `AnaTrail`

supports
*initial displacement* - this can account for drawing
rectangles from their center, for example.

- data TrailSegment u
- data CatTrail u
- data AnaTrail u
- renderAnaTrail :: InterpretUnit u => PathMode -> AnaTrail u -> LocGraphic u
- renderCatTrail :: InterpretUnit u => PathMode -> CatTrail u -> LocGraphic u
- destrAnaTrail :: AnaTrail u -> (Vec2 u, [TrailSegment u])
- destrCatTrail :: CatTrail u -> [TrailSegment u]
- anaCatTrail :: Vec2 u -> CatTrail u -> AnaTrail u
- modifyAna :: (Vec2 u -> Vec2 u) -> AnaTrail u -> AnaTrail u
- trailIterateLocus :: Num u => [Vec2 u] -> AnaTrail u
- anaTrailPoints :: InterpretUnit u => AnaTrail u -> LocQuery u [Point2 u]
- catline :: Vec2 u -> CatTrail u
- catcurve :: Vec2 u -> Vec2 u -> Vec2 u -> CatTrail u
- orthoCatTrail :: Floating u => u -> u -> Radian -> CatTrail u
- diffCurve :: Num u => Point2 u -> Point2 u -> Point2 u -> Point2 u -> CatTrail u
- diffLines :: Num u => [Point2 u] -> CatTrail u
- rectangleTrail :: Fractional u => u -> u -> AnaTrail u
- diamondTrail :: Num u => u -> u -> AnaTrail u
- polygonTrail :: Floating u => Int -> u -> AnaTrail u
- wedgeTrail :: (Real u, Floating u) => u -> Radian -> Radian -> AnaTrail u
- trail_up :: Num u => u -> CatTrail u
- trail_down :: Num u => u -> CatTrail u
- trail_left :: Num u => u -> CatTrail u
- trail_right :: Num u => u -> CatTrail u
- trail_north :: Num u => u -> CatTrail u
- trail_south :: Num u => u -> CatTrail u
- trail_east :: Num u => u -> CatTrail u
- trail_west :: Num u => u -> CatTrail u
- trail_north_east :: Floating u => u -> CatTrail u
- trail_north_west :: Floating u => u -> CatTrail u
- trail_south_east :: Floating u => u -> CatTrail u
- trail_south_west :: Floating u => u -> CatTrail u
- trail_up_left :: Num u => u -> CatTrail u
- trail_up_right :: Num u => u -> CatTrail u
- trail_down_left :: Num u => u -> CatTrail u
- trail_down_right :: Num u => u -> CatTrail u
- trail_para :: Floating u => u -> Radian -> CatTrail u
- trail_perp :: Floating u => u -> Radian -> CatTrail u
- trail_theta_up :: Floating u => u -> Radian -> CatTrail u
- trail_theta_down :: Floating u => u -> Radian -> CatTrail u
- trail_theta_left :: Floating u => u -> Radian -> CatTrail u
- trail_theta_right :: Floating u => u -> Radian -> CatTrail u
- trail_theta_north :: Floating u => u -> Radian -> CatTrail u
- trail_theta_south :: Floating u => u -> Radian -> CatTrail u
- trail_theta_east :: Floating u => u -> Radian -> CatTrail u
- trail_theta_west :: Floating u => u -> Radian -> CatTrail u
- trail_theta_north_east :: Floating u => u -> Radian -> CatTrail u
- trail_theta_north_west :: Floating u => u -> Radian -> CatTrail u
- trail_theta_south_east :: Floating u => u -> Radian -> CatTrail u
- trail_theta_south_west :: Floating u => u -> Radian -> CatTrail u
- trail_theta_up_left :: Floating u => u -> Radian -> CatTrail u
- trail_theta_up_right :: Floating u => u -> Radian -> CatTrail u
- trail_theta_down_left :: Floating u => u -> Radian -> CatTrail u
- trail_theta_down_right :: Floating u => u -> Radian -> CatTrail u
- trail_theta_adj_grazing :: Floating u => u -> Radian -> Radian -> CatTrail u
- trail_theta_bkwd_adj_grazing :: Floating u => u -> Radian -> Radian -> CatTrail u
- semicircleTrail :: (Real u, Floating u) => ClockDirection -> Vec2 u -> CatTrail u
- semiellipseTrail :: (Real u, Floating u) => ClockDirection -> u -> Vec2 u -> CatTrail u
- minorCircleSweep :: (Real u, Floating u) => ClockDirection -> Radian -> u -> Radian -> CatTrail u
- circleSweep :: (Real u, Floating u) => ClockDirection -> Radian -> u -> Radian -> CatTrail u
- circularArc :: (Real u, Floating u) => ClockDirection -> Radian -> u -> Radian -> CatTrail u
- sineWave :: (Real u, Floating u) => Int -> u -> Radian -> CatTrail u
- sineWave1 :: (Real u, Floating u) => u -> u -> Radian -> CatTrail u
- squareWave :: Floating u => Int -> u -> Radian -> CatTrail u
- sawtoothWave :: (Real u, Floating u) => Int -> u -> Radian -> CatTrail u
- squiggleWave :: (Real u, Floating u) => Int -> u -> Radian -> CatTrail u
- semicircleWave :: (Real u, Floating u) => ClockDirection -> Int -> u -> Radian -> CatTrail u
- triCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail u
- rectCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail u
- trapCurve :: Floating u => ClockDirection -> u -> u -> Radian -> Radian -> CatTrail u
- bowCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail u
- wedgeCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail u
- loopCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail u

# Trail types

data TrailSegment u Source

Trail segment - trails are *prototype* paths, so the are
built from the usual straight lines and Bezier curves.

Functor TrailSegment | |

(Ord u, Tolerance u) => Eq (TrailSegment u) | |

(Ord u, Tolerance u) => Ord (TrailSegment u) | |

Show u => Show (TrailSegment u) |

Trail with an initial (undrawn) displacement - an anacrusis.

This allows trails to represent centered objects.

# Trail operations

renderAnaTrail :: InterpretUnit u => PathMode -> AnaTrail u -> LocGraphic uSource

Render an `AnaTrail`

to make a drawable `LocGraphic`

.

renderCatTrail :: InterpretUnit u => PathMode -> CatTrail u -> LocGraphic uSource

Render a `CatTrail`

to make a drawable `LocGraphic`

.

destrAnaTrail :: AnaTrail u -> (Vec2 u, [TrailSegment u])Source

*Destructor* for the opaque `AnaTrail`

type.

destrCatTrail :: CatTrail u -> [TrailSegment u]Source

*Destructor* for the opaque `CatTrail`

type.

trailIterateLocus :: Num u => [Vec2 u] -> AnaTrail uSource

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

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

Like `trailStartIsLocus`

, 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*.

anaTrailPoints :: InterpretUnit u => AnaTrail u -> LocQuery u [Point2 u]Source

orthoCatTrail :: Floating u => u -> u -> Radian -> CatTrail uSource

Alternative to `catline`

, specifying the vector components
rather the vector itself.

(cf. orthoVec from Wumpus-Core)

diffCurve :: Num u => Point2 u -> Point2 u -> Point2 u -> Point2 u -> CatTrail uSource

Form a Bezier CatTrail from the vectors between four control points.

diffLines :: Num u => [Point2 u] -> CatTrail uSource

Form a CatTrail from the linear segment joining the list of points.

Some configurations of vectors seem easier to specify using located points then making them coordinate free by taking the joining vectors.

# Shape trails

rectangleTrail :: Fractional u => u -> u -> AnaTrail uSource

`rectangleTrail`

: ` width * height -> AnaTrail `

diamondTrail :: Num u => u -> u -> AnaTrail uSource

`diamondTrail`

: ` half_width * half_height -> AnaTrail `

polygonTrail :: Floating u => Int -> u -> AnaTrail uSource

`polygonTrail`

: ` num_points * radius -> AnaTrail `

wedgeTrail :: (Real u, Floating u) => u -> Radian -> Radian -> AnaTrail uSource

wedgeTrail : radius * apex_angle

Wedge is drawn at the apex.

# Named Trail constructors

trail_down :: Num u => u -> CatTrail uSource

trail_left :: Num u => u -> CatTrail uSource

trail_right :: Num u => u -> CatTrail uSource

trail_north :: Num u => u -> CatTrail uSource

trail_south :: Num u => u -> CatTrail uSource

trail_east :: Num u => u -> CatTrail uSource

trail_west :: Num u => u -> CatTrail uSource

trail_north_east :: Floating u => u -> CatTrail uSource

trail_north_west :: Floating u => u -> CatTrail uSource

trail_south_east :: Floating u => u -> CatTrail uSource

trail_south_west :: Floating u => u -> CatTrail uSource

trail_up_left :: Num u => u -> CatTrail uSource

trail_up_right :: Num u => u -> CatTrail uSource

trail_down_left :: Num u => u -> CatTrail uSource

trail_down_right :: Num u => u -> CatTrail uSource

trail_para :: Floating u => u -> Radian -> CatTrail uSource

trail_perp :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_up :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_down :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_left :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_right :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_north :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_south :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_east :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_west :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_north_east :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_north_west :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_south_east :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_south_west :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_up_left :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_up_right :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_down_left :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_down_right :: Floating u => u -> Radian -> CatTrail uSource

trail_theta_adj_grazing :: Floating u => u -> Radian -> Radian -> CatTrail uSource

Return the line `a-o`

when supplied length of `b-o`

and the
grazing angle `boa`

:

a .\ . \ ..b..o

This is useful for building arrowhead vectors.

trail_theta_bkwd_adj_grazing :: Floating u => u -> Radian -> Radian -> CatTrail uSource

Return the line `o-c`

when supplied length of `b-o`

and the
grazing angle `boc`

:

..b..o . / ./ c

This is useful for building arrowhead vectors.

semicircleTrail :: (Real u, Floating u) => ClockDirection -> Vec2 u -> CatTrail uSource

`semicircleCW`

: ` base_vector -> CatTrail `

Make an open semicircle from two Bezier curves.

Although this function produces an approximation of a semicircle, the approximation seems fine in practice.

semiellipseTrail :: (Real u, Floating u) => ClockDirection -> u -> Vec2 u -> CatTrail uSource

`semicircleTrail`

: ` clock_direction * ry * base_vector -> CatTrail `

Make an open semiellipse from two Bezier curves.

Although this function produces an approximation of a semiellipse, the approximation seems fine in practice.

minorCircleSweep :: (Real u, Floating u) => ClockDirection -> Radian -> u -> Radian -> CatTrail uSource

`minorCircleSweep`

: ```
clock_direction * angle * radius
* inclination -> CatTrail
```

ang should be in the range 0 < ang <= 90deg.

circleSweep :: (Real u, Floating u) => ClockDirection -> Radian -> u -> Radian -> CatTrail uSource

`circleSweep`

: ```
clock_direction * apex_angle * radius
* inclination -> CatTrail
```

ang should be in the range 0 < ang < 360deg.

if 0 < ang <= 90 returns 1 segment if 90 < ang <= 180 returns 2 segments if 180 < ang <= 270 returns 3 segments if 270 < ang < 360 returns 4 segmenets

circularArc :: (Real u, Floating u) => ClockDirection -> Radian -> u -> Radian -> CatTrail uSource

sineWave1 :: (Real u, Floating u) => u -> u -> Radian -> CatTrail uSource

One-phase sine wave. Height is parametric.

squiggleWave :: (Real u, Floating u) => Int -> u -> Radian -> CatTrail uSource

Proper semicircles do not make a good squiggle (it needs a bit of pinch).

semicircleWave :: (Real u, Floating u) => ClockDirection -> Int -> u -> Radian -> CatTrail uSource

triCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail uSource

`triCurve`

: ```
clock_direction * base_width * height *
base_inclination -> CatTrail
```

Curve in a triangle - base_width and height are expected to be positive.

rectCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail uSource

`rectCurve`

: ```
clock_direction * base_width * height *
base_inclination -> CatTrail
```

Curve in a rectangle.

trapCurve :: Floating u => ClockDirection -> u -> u -> Radian -> Radian -> CatTrail uSource

Curve in a trapezium.

bowCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail uSource

Curve in half a *bowtie*.

wedgeCurve :: Floating u => ClockDirection -> u -> u -> Radian -> CatTrail uSource

Wedge curve formed inside a bowtie rotated by 90deg.