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

Stability | highly unstable |

Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |

Extended path type - more amenable for complex drawings than the type in Wumpus-Core.

** WARNING ** this module is an experiment, and may change significantly or even be dropped from future revisions.

- data Path u
- type DPath = Path Double
- length :: Num u => Path u -> u
- append :: Floating u => Path u -> Path u -> Path u
- pconcat :: Floating u => Path u -> [Path u] -> Path u
- line :: Floating u => Point2 u -> Point2 u -> Path u
- curve :: (Floating u, Ord u) => Point2 u -> Point2 u -> Point2 u -> Point2 u -> Path u
- pivot :: Floating u => Point2 u -> Path u
- traceLinePoints :: Floating u => [Point2 u] -> Path u
- traceCurvePoints :: (Floating u, Ord u) => [Point2 u] -> Path u
- curveByAngles :: (Floating u, Ord u) => Point2 u -> Radian -> Radian -> Point2 u -> Path u
- toPrimPath :: Path u -> PrimPath u
- tipL :: Path u -> Point2 u
- tipR :: Path u -> Point2 u
- shortenBoth :: (Real u, Floating u) => u -> Path u -> Path u
- shortenL :: (Real u, Floating u) => u -> Path u -> Path u
- shortenR :: (Real u, Floating u) => u -> Path u -> Path u
- directionL :: (Real u, Floating u) => Path u -> Radian
- directionR :: (Real u, Floating u) => Path u -> Radian
- midway :: (Real u, Floating u) => Path u -> (Point2 u, Radian)
- midway_ :: (Real u, Floating u) => Path u -> Point2 u
- atstart :: (Real u, Floating u) => Path u -> (Point2 u, Radian)
- atstart_ :: Path u -> Point2 u
- atend :: (Real u, Floating u) => Path u -> (Point2 u, Radian)
- atend_ :: Path u -> Point2 u
- data PathViewL u
- = PathOneL (PathSegment u)
- | (PathSegment u) :<< (Path u)

- type DPathViewL = PathViewL Double
- data PathViewR u
- = PathOneR (PathSegment u)
- | (Path u) :>> (PathSegment u)

- type DPathViewR = PathViewR Double
- data PathSegment u
- type DPathSegment = PathSegment Double
- pathViewL :: Num u => Path u -> PathViewL u
- pathViewR :: Num u => Path u -> PathViewR u

# Documentation

pivot :: Floating u => Point2 u -> Path uSource

A draw a *straight line* of length 0 at the supplied point.

This is *might* be useful in concatenating curved paths
as it introduces and extra control point.

traceLinePoints :: Floating u => [Point2 u] -> Path uSource

`traceLinePoints`

throws a runtime error if the supplied list
is empty.

traceCurvePoints :: (Floating u, Ord u) => [Point2 u] -> Path uSource

`traceCurvePoints`

consumes 4 points from the list on the
intial step (start, control1, control2, end) then steps
through the list taking 3 points at a time thereafter
(control1,control2, end). Leftover points are discarded.

`traceCurvePoints`

throws a runtime error if the supplied list
is has less than 4 elements (start, control1, control2, end).

toPrimPath :: Path u -> PrimPath uSource

Turn a Path into an ordinary PrimPath.

Assumes path is properly formed - i.e. end point of one segment is the same point as the start point of the next segment.

shortenBoth :: (Real u, Floating u) => u -> Path u -> Path uSource

Shorten both ends...

u should be less-than half the path length

shortenL :: (Real u, Floating u) => u -> Path u -> Path uSource

Note - shortening a line from the left by greater-than-or-equal its length is operationally equivalent to making a zero-length line at the end point.

shortenR :: (Real u, Floating u) => u -> Path u -> Path uSource

Note - shortening a line from the right by greater-than-or-equal its length is operationally equivalent to making a zero-length line at the start point.

directionL :: (Real u, Floating u) => Path u -> RadianSource

Direction of empty path is considered to be 0.

directionR :: (Real u, Floating u) => Path u -> RadianSource

Direction of empty path is considered to be 0.

PathOneL (PathSegment u) | |

(PathSegment u) :<< (Path u) |

type DPathViewL = PathViewL DoubleSource

PathOneR (PathSegment u) | |

(Path u) :>> (PathSegment u) |

type DPathViewR = PathViewR DoubleSource

data PathSegment u Source

Eq u => Eq (PathSegment u) | |

Ord u => Ord (PathSegment u) | |

Show u => Show (PathSegment u) |

type DPathSegment = PathSegment DoubleSource