Safe Haskell | None |
---|---|
Language | Haskell2010 |
Waterfall.TwoD.Shape
Contents
Synopsis
- data Shape
- makeShape :: Path2D -> Shape
- shapePaths :: Shape -> [Path2D]
- unitCircle :: Shape
- unitSquare :: Shape
- centeredSquare :: Shape
- unitPolygon :: Integer -> Shape
- union2D :: Shape -> Shape -> Shape
- difference2D :: Shape -> Shape -> Shape
- intersection2D :: Shape -> Shape -> Shape
- unions2D :: [Shape] -> Shape
- intersections2D :: [Shape] -> Shape
- emptyShape :: Shape
Documentation
A Region in 2D Space
In general, this is used as a face, and extruded along some sort of path
Under the hood, this is represented by an OpenCascade Shape
This should be of type Face
, constrained to the plane \( z=0 \).
Please feel free to report a bug if you're able to construct a Shape
which does not lie on this plane (without using Internal functions).
Or which is not either a Face
, or a composite of faces.
shapePaths :: Shape -> [Path2D] Source #
Get the paths back from a 2D shape
Ideally:
shapePaths . fromPath ≡ pure
unitCircle :: Shape Source #
Circle with radius 1, centered on the origin
unitSquare :: Shape Source #
Square with side length of 1, one vertex on the origin, another on \( (1, 1) \)
centeredSquare :: Shape Source #
Square with side length of 1, centered on the origin
unitPolygon :: Integer -> Shape Source #
\(n\) sided Polygon, centered on the origin
Ill-defined when n <= 2
Boolean operations
union2D :: Shape -> Shape -> Shape Source #
Take the union of two 2D shapes. The region occupied by either one of them
difference2D :: Shape -> Shape -> Shape Source #
Take the difference of two 2D shapes. The region occupied by the first, but not the second
intersection2D :: Shape -> Shape -> Shape Source #
Take the intersection of two 2D shapes. The region occupied by both of them
unions2D :: [Shape] -> Shape Source #
Take the union of a list of 2D shapes
May be more performant than chaining multiple applications of union2D
intersections2D :: [Shape] -> Shape Source #
Take the intersection of a list of 2D shapes
May be more performant than chaining multiple applications of intersection2D
emptyShape :: Shape Source #
An empty 2D shape