Safe Haskell | None |
---|---|
Language | Haskell2010 |
Waterfall.TwoD.Path2D
Description
Paths in 2D space.
Synopsis
- data Path2D
- data Sense
- module Waterfall.Path.Common
- arc :: Sense -> Double -> V2 Double -> V2 Double -> Path2D
- arcTo :: Sense -> Double -> V2 Double -> V2 Double -> (V2 Double, Path2D)
- arcRelative :: Sense -> Double -> V2 Double -> V2 Double -> (V2 Double, Path2D)
- repeatLooping :: Path2D -> Path2D
- line2D :: V2 Double -> V2 Double -> Path2D
- lineTo2D :: V2 Double -> V2 Double -> (V2 Double, Path2D)
- lineRelative2D :: V2 Double -> V2 Double -> (V2 Double, Path2D)
- arcVia2D :: V2 Double -> V2 Double -> V2 Double -> Path2D
- arcViaTo2D :: V2 Double -> V2 Double -> V2 Double -> (V2 Double, Path2D)
- arcViaRelative2D :: V2 Double -> V2 Double -> V2 Double -> (V2 Double, Path2D)
- bezier2D :: V2 Double -> V2 Double -> V2 Double -> V2 Double -> Path2D
- bezierTo2D :: V2 Double -> V2 Double -> V2 Double -> V2 Double -> (V2 Double, Path2D)
- bezierRelative2D :: V2 Double -> V2 Double -> V2 Double -> V2 Double -> (V2 Double, Path2D)
- pathFrom2D :: V2 Double -> [V2 Double -> (V2 Double, Path2D)] -> Path2D
- pathFromTo2D :: [V2 Double -> (V2 Double, Path2D)] -> V2 Double -> (V2 Double, Path2D)
- pathEndpoints2D :: Path2D -> Maybe (V2 Double, V2 Double)
- closeLoop2D :: Path2D -> Path2D
- reversePath2D :: Path2D -> Path2D
- splice2D :: Path2D -> V2 Double -> (V2 Double, Path2D)
- splitPath2D :: Path2D -> [Path2D]
Documentation
A Path in 2D Space
Under the hood, this is represented by an OpenCascade Wire
, constrained to the plane \(z=0\).
Please feel free to report a bug if you're able to construct a Path2D
which does not lie on this plane (without using Internal functions).
The monoid instance Joins Path2D
s, a <> b
connects the end point of a
to the start of b
, if these points are not coincident, a line is created between them.
Instances
Monoid Path2D Source # | |
Semigroup Path2D Source # | |
Transformable2D Path2D Source # | |
AnyPath (V2 Double) Path2D Source # | |
Constructors
Clockwise | |
Counterclockwise |
module Waterfall.Path.Common
arc :: Sense -> Double -> V2 Double -> V2 Double -> Path2D Source #
Section of a circle, with a given radius, that lies between two points.
This may fail, if the radius is less than half of the distance between the points.
In general, arcVia
is the "safer" way to construct an arc.
arc
is not polymorphic, as it would not be possible to define an arc in 3D space in this way.
repeatLooping :: Path2D -> Path2D Source #
Given a Path where both endpoints are equidistant from the origin.
And which subtends an angle \( φ \) from the origin that evenly divides a complete revolution, such that \(n φ = 2 π \).
Replicates the path \( n \) times, rotating it by \( φ \), until the resulting path completes one revolution around the origin.
This can be used to construct paths with rotational symmetry, such as regular polygons, or gears.
lineRelative2D :: V2 Double -> V2 Double -> (V2 Double, Path2D) Source #
lineRelative
, with the type fixed to Path2D
arcViaRelative2D :: V2 Double -> V2 Double -> V2 Double -> (V2 Double, Path2D) Source #
arcViaRelative
, with the type fixed to Path2D
bezierRelative2D :: V2 Double -> V2 Double -> V2 Double -> V2 Double -> (V2 Double, Path2D) Source #
bezierRelative
, with the type fixed to Path2D
pathFromTo2D :: [V2 Double -> (V2 Double, Path2D)] -> V2 Double -> (V2 Double, Path2D) Source #
pathFromTo
, with the type fixed to Path2D
pathEndpoints2D :: Path2D -> Maybe (V2 Double, V2 Double) Source #
pathEndpoints
, with the type fixed to Path2D
reversePath2D :: Path2D -> Path2D Source #
reversePath
with the type fixed to Path2D