wumpus-basic-0.12.0: Common drawing utilities built on wumpus-core.

PortabilityGHC
Stabilityhighly unstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>

Wumpus.Basic.Paths.Base

Description

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.

Synopsis

Documentation

data Path u Source

Instances

Eq u => Eq (Path u) 
Ord u => Ord (Path u) 
Show u => Show (Path u) 

length :: Num u => Path u -> uSource

append :: Floating u => Path u -> Path u -> Path uSource

pconcat :: Floating u => Path u -> [Path u] -> Path uSource

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

curve :: (Floating u, Ord u) => Point2 u -> Point2 u -> Point2 u -> Point2 u -> Path uSource

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.

midway :: (Real u, Floating u) => Path u -> (Point2 u, Radian)Source

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

atstart :: (Real u, Floating u) => Path u -> (Point2 u, Radian)Source

atend :: (Real u, Floating u) => Path u -> (Point2 u, Radian)Source

data PathViewL u Source

Constructors

PathOneL (PathSegment u) 
(PathSegment u) :<< (Path u) 

Instances

Eq u => Eq (PathViewL u) 
Ord u => Ord (PathViewL u) 
Show u => Show (PathViewL u) 

data PathViewR u Source

Constructors

PathOneR (PathSegment u) 
(Path u) :>> (PathSegment u) 

Instances

Eq u => Eq (PathViewR u) 
Ord u => Ord (PathViewR u) 
Show u => Show (PathViewR u) 

data PathSegment u Source

Constructors

Line1 (Point2 u) (Point2 u) 
Curve1 (Point2 u) (Point2 u) (Point2 u) (Point2 u) 

Instances

Eq u => Eq (PathSegment u) 
Ord u => Ord (PathSegment u) 
Show u => Show (PathSegment u)