Safe Haskell | None |
---|---|
Language | Haskell2010 |
Waterfall.Booleans
Description
Constructive Solid Geometry \(CSG\) operations on Solid
, and Shape
.
Synopsis
- union3D :: Solid -> Solid -> Solid
- difference3D :: Solid -> Solid -> Solid
- intersection3D :: Solid -> Solid -> Solid
- complement :: Solid -> Solid
- unions3D :: [Solid] -> Solid
- intersections3D :: [Solid] -> Solid
- class Boolean a where
- union :: a -> a -> a
- difference :: a -> a -> a
- intersection :: a -> a -> a
- empty :: a
- unions :: [a] -> a
- intersections :: [a] -> a
Documentation
union3D :: Solid -> Solid -> Solid Source #
Take the sum of two solids
The region occupied by either one of them.
difference3D :: Solid -> Solid -> Solid Source #
Take the difference of two solids
The region occupied by the first, but not the second.
intersection3D :: Solid -> Solid -> Solid Source #
Take the intersection of two solids
The region occupied by both of them.
complement :: Solid -> Solid Source #
Invert a Solid, equivalent to not
in boolean algebra.
The complement of a solid represents the solid with the same surface, but where the opposite side of that surface is the "inside" of the solid.
Be warned that complement emptySolid
does not appear to work correctly.
unions3D :: [Solid] -> Solid Source #
Take the sum of a list of solids
May be more performant than chaining multiple applications of union3D
intersections3D :: [Solid] -> Solid Source #
Take the intersection of a list of solids
May be more performant than chaining multiple applications of intersection3D
class Boolean a where Source #
Boolean Algebras, with an "empty" value.
Minimal complete definition
Methods
Take the union of two objects
The region occupied by either one of them.
difference :: a -> a -> a Source #
Take the difference of two objects
The region occupied by the first, but not the second.
intersection :: a -> a -> a Source #
Take the intersection of two objects
The region occupied by both of them.
The empty object (identity for union, annihilator for intersection)
Represents a region of space containing no volume or area.
For union: empty
For intersection: union
x = x union
empty = xempty
intersection
x = x intersection
empty = empty
Take the union of a list of objects
May be more performant than chaining multiple applications of union
.
intersections :: [a] -> a Source #
Take the intersection of a list of objects
May be more performant than chaining multiple applications of intersection
.