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 :: Num u => Path u -> PrimPath u
- tipL :: Path u -> Point2 u
- tipR :: Path u -> Point2 u
- shortenPath :: (Real u, Floating u) => 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
- roundTrail :: (Real u, Floating u) => u -> [Point2 u] -> Path u
- roundInterior :: (Real u, Floating u) => u -> [Point2 u] -> Path 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 :: Num u => 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.
shortenPath :: (Real u, Floating u) => u -> u -> Path u -> Path uSource
sortenPath
: left_dist * right_dist * path -> Path
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) | |
Show u => Show (PathSegment u) |
type DPathSegment = PathSegment DoubleSource
roundTrail :: (Real u, Floating u) => u -> [Point2 u] -> Path uSource
roundTrail
: rounding_distance * [point] -> Path
Build a path from the list of vertices, all the interior corners are rounded by the rounding distance *and* final round corner is created "incorporating" the start point (as the start point becomes a rounded corner the actual path will not intersect it).
It is expected that this function will be used to create round cornered shapes.
roundTrail
throws a runtime error if the input list is empty.
If the list has one element the null path is built, if the
list has two elements a straight line is built.
roundInterior :: (Real u, Floating u) => u -> [Point2 u] -> Path uSource
roundInterior
: rounding_distance * [point] -> Path
Build a path from the list of vertices, all the interior
corners are rounded by the rounding distance. Unlike
roundTrail
there is no loop around to the start point,
and start path will begin exactly on the start point and end
exactly on the end point.
roundInterior
throws a runtime error if the input list is
empty. If the list has one element the null path is built,
if the list has two elements a straight line is built.