wumpus-drawing-0.2.0: High-level drawing objects built on Wumpus-Basic.

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

Wumpus.Drawing.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) 
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, FromPtSize 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, FromPtSize 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.

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) 
Show u => Show (PathViewL u) 

data PathViewR u Source

Constructors

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

Instances

Eq u => Eq (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) 
Show u => Show (PathSegment u) 

roundTrail :: (Real u, Floating u, FromPtSize 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, FromPtSize 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.