Safe Haskell | None |
---|---|
Language | Haskell2010 |
Paths in 2D / 3D space.
This module defines functions that can be used with Waterfall.Path or Waterfall.TwoD.Path2D. Those modules both export monomorphized variants of the functions defined in this module
Synopsis
- class AnyPath point path | path -> point
- line :: AnyPath point path => point -> point -> path
- lineTo :: AnyPath point path => point -> point -> (point, path)
- lineRelative :: (AnyPath point path, Num point) => point -> point -> (point, path)
- arcVia :: AnyPath point path => point -> point -> point -> path
- arcViaTo :: AnyPath point path => point -> point -> point -> (point, path)
- arcViaRelative :: (AnyPath point path, Num point) => point -> point -> point -> (point, path)
- bezier :: AnyPath point path => point -> point -> point -> point -> path
- bezierTo :: AnyPath point path => point -> point -> point -> point -> (point, path)
- bezierRelative :: (AnyPath point path, Num point) => point -> point -> point -> point -> (point, path)
- pathFrom :: Monoid path => point -> [point -> (point, path)] -> path
- pathFromTo :: Monoid path => [point -> (point, path)] -> point -> (point, path)
Documentation
class AnyPath point path | path -> point Source #
Class used to abstract over constructing Path
and Path2D
There are instances for AnyPath (V3 Double) Path
and for AnyPath (V2 Double) Path2D
fromWire, pointToGPPnt
lineRelative :: (AnyPath point path, Num point) => point -> point -> (point, path) Source #
arcVia :: AnyPath point path => point -> point -> point -> path Source #
Section of a circle based on three arguments, the start point, a point on the arc, and the endpoint
arcViaRelative :: (AnyPath point path, Num point) => point -> point -> point -> (point, path) Source #
bezier :: AnyPath point path => point -> point -> point -> point -> path Source #
Bezier curve of order 3
The arguments are, the start of the curve, the two control points, and the end of the curve
bezierRelative :: (AnyPath point path, Num point) => point -> point -> point -> point -> (point, path) Source #
pathFrom :: Monoid path => point -> [point -> (point, path)] -> path Source #
When combining paths, we're generally interested in pairs of paths that share a common endpoint.
Rather than having to repeat these common endpoints, pathFrom
can be used to combine a list of path components.
Where a path component is a function from a start point, to a tuple of an end point, and a path; V2 Double -> (V2 Double, Path2D)
.
A typical use of pathFrom
uses a list of functions with the suffix "To" or "Relative", e.g:
Path.pathFrom zero [ Path.bezierRelative (V3 0 0 0.5) (V3 0.5 0.5 0.5) (V3 0.5 0.5 1) , Path.bezierRelative (V3 0 0 0.5) (V3 (-0.5) (-0.5) 0.5) (V3 (-0.5) (-0.5) 1) , Path.arcViaRelative (V3 0 1 1) (V3 0 2 0) , Path.lineTo (V3 0 2 0) ]
pathFromTo :: Monoid path => [point -> (point, path)] -> point -> (point, path) Source #
Combines a list of "path components", as used by pathFrom