waterfall-cad-0.0.0.1: Declarative CAD/Solid Modeling Library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Waterfall.Path

Description

Paths in 3D space.

This module exposes functions with the same names as Waterfall.TwoD.Path2D, and if used together they should be imported qualified.

Synopsis

Documentation

data Path Source #

A Path in 3D Space

Under the hood, this is represented by an OpenCascade Wire.

Instances

Instances details
Monoid Path Source # 
Instance details

Defined in Waterfall.Internal.Path

Methods

mempty :: Path #

mappend :: Path -> Path -> Path #

mconcat :: [Path] -> Path #

Semigroup Path Source #

The Semigroup for Path attempts to join two paths that share a common endpoint.

Attempts to combine paths that do not share a common endpoint currently in an error case that is not currently handled gracefully.

Instance details

Defined in Waterfall.Internal.Path

Methods

(<>) :: Path -> Path -> Path #

sconcat :: NonEmpty Path -> Path #

stimes :: Integral b => b -> Path -> Path #

Transformable Path Source # 
Instance details

Defined in Waterfall.Transforms

line :: V3 Double -> V3 Double -> Path Source #

A straight line between two points

lineTo :: V3 Double -> V3 Double -> (V3 Double, Path) Source #

Version of line designed to work with pathFrom

lineRelative :: V3 Double -> V3 Double -> (V3 Double, Path) Source #

Version of line designed to work with pathFrom

With relative points; specifying the distance of the endpoint relative to the start of the line, rather than in absolute space.

arcVia :: V3 Double -> V3 Double -> V3 Double -> Path Source #

Section of a circle based on three arguments, the start point, a point on the arc, and the endpoint

arcViaTo :: V3 Double -> V3 Double -> V3 Double -> (V3 Double, Path) Source #

Version of arcVia designed to work with pathFrom

The first argument is a point on the arc The second argument is the endpoint of the arc

arcViaRelative :: V3 Double -> V3 Double -> V3 Double -> (V3 Double, Path) Source #

Version of arcVia designed to work with pathFrom

With relative points; specifying the distance of the midpoint and endpoint relative to the start of the line, rather than in absolute space.

bezier :: V3 Double -> V3 Double -> V3 Double -> V3 Double -> 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

bezierTo :: V3 Double -> V3 Double -> V3 Double -> V3 Double -> (V3 Double, Path) Source #

Version of bezier designed to work with pathFrom

bezierRelative :: V3 Double -> V3 Double -> V3 Double -> V3 Double -> (V3 Double, Path) Source #

Version of bezier designed to work with pathFrom

With relative points; specifying the distance of the control points and the endpoint relative to the start of the line, rather than in absolute space.

pathFrom :: V3 Double -> [V3 Double -> (V3 Double, 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 :: [V3 Double -> (V3 Double, Path)] -> V3 Double -> (V3 Double, Path) Source #

Combines a list of "path components", as used by pathFrom