module Graphics.Implicit.Definitions (
ℝ,
ℝ2,
ℝ3,
minℝ,
ℕ,
(⋅),
(⋯*),
(⋯/),
Polyline,
Triangle,
NormedTriangle,
TriangleMesh,
NormedTriangleMesh,
Obj2,
Obj3,
Box2,
Box3,
Boxed2,
Boxed3,
BoxedObj2,
BoxedObj3,
SymbolicObj2(
RectR,
Circle,
PolygonR,
Complement2,
UnionR2,
DifferenceR2,
IntersectR2,
Translate2,
Scale2,
Rotate2,
Shell2,
Outset2,
EmbedBoxedObj2),
SymbolicObj3(
Rect3R,
Sphere,
Cylinder,
Complement3,
UnionR3,
IntersectR3,
DifferenceR3,
Translate3,
Scale3,
Rotate3,
Rotate3V,
Shell3,
Outset3,
EmbedBoxedObj3,
ExtrudeR,
ExtrudeRotateR,
ExtrudeRM,
ExtrudeOnEdgeOf,
RotateExtrude),
Rectilinear2,
Rectilinear3,
)
where
import Prelude (Show, Double, Integer, Maybe, Either, show, (*), (/))
import Data.VectorSpace (Scalar, InnerSpace, (<.>))
type ℝ = Double
type ℝ2 = (ℝ,ℝ)
type ℝ3 = (ℝ,ℝ,ℝ)
minℝ :: ℝ
minℝ = 0.0000000000000002
type ℕ = Integer
(⋅) :: InnerSpace a => a -> a -> Scalar a
(⋅) = (<.>)
instance Show (ℝ -> ℝ) where
show _ = "<function ℝ>"
instance Show (ℝ -> ℝ2) where
show _ = "<expand ℝ -> ℝ2>"
instance Show (ℝ2 -> ℝ) where
show _ = "<collapse ℝ2 -> ℝ>"
instance Show (ℝ3 -> ℝ) where
show _ = "<collapse ℝ3 -> ℝ>"
class ComponentWiseMultable a where
(⋯*) :: a -> a -> a
(⋯/) :: a -> a -> a
instance ComponentWiseMultable ℝ2 where
(x,y) ⋯* (x',y') = (x*x', y*y')
(x,y) ⋯/ (x',y') = (x/x', y/y')
instance ComponentWiseMultable ℝ3 where
(x,y,z) ⋯* (x',y',z') = (x*x', y*y', z*z')
(x,y,z) ⋯/ (x',y',z') = (x/x', y/y', z/z')
type Polyline = [ℝ2]
type Triangle = (ℝ3, ℝ3, ℝ3)
type NormedTriangle = ((ℝ3, ℝ3), (ℝ3, ℝ3), (ℝ3, ℝ3))
type TriangleMesh = [Triangle]
type NormedTriangleMesh = [NormedTriangle]
type Obj2 = (ℝ2 -> ℝ)
type Obj3 = (ℝ3 -> ℝ)
type Box2 = (ℝ2, ℝ2)
type Box3 = (ℝ3, ℝ3)
type Boxed2 a = (a, Box2)
type Boxed3 a = (a, Box3)
type BoxedObj2 = Boxed2 Obj2
type BoxedObj3 = Boxed3 Obj3
data SymbolicObj2 =
RectR ℝ ℝ2 ℝ2
| Circle ℝ
| PolygonR ℝ [ℝ2]
| Complement2 SymbolicObj2
| UnionR2 ℝ [SymbolicObj2]
| DifferenceR2 ℝ [SymbolicObj2]
| IntersectR2 ℝ [SymbolicObj2]
| Translate2 ℝ2 SymbolicObj2
| Scale2 ℝ2 SymbolicObj2
| Rotate2 ℝ SymbolicObj2
| Outset2 ℝ SymbolicObj2
| Shell2 ℝ SymbolicObj2
| EmbedBoxedObj2 BoxedObj2
deriving Show
data SymbolicObj3 =
Rect3R ℝ ℝ3 ℝ3
| Sphere ℝ
| Cylinder ℝ ℝ ℝ
| Complement3 SymbolicObj3
| UnionR3 ℝ [SymbolicObj3]
| DifferenceR3 ℝ [SymbolicObj3]
| IntersectR3 ℝ [SymbolicObj3]
| Translate3 ℝ3 SymbolicObj3
| Scale3 ℝ3 SymbolicObj3
| Rotate3 ℝ3 SymbolicObj3
| Rotate3V ℝ ℝ3 SymbolicObj3
| Outset3 ℝ SymbolicObj3
| Shell3 ℝ SymbolicObj3
| EmbedBoxedObj3 BoxedObj3
| ExtrudeR ℝ SymbolicObj2 ℝ
| ExtrudeRotateR ℝ ℝ SymbolicObj2 ℝ
| ExtrudeRM
ℝ
(Maybe (ℝ -> ℝ))
(Maybe (ℝ -> ℝ))
(Maybe (ℝ -> ℝ2))
SymbolicObj2
(Either ℝ (ℝ2 -> ℝ))
| RotateExtrude
ℝ
(Maybe ℝ)
(Either ℝ2 (ℝ -> ℝ2))
(Either ℝ (ℝ -> ℝ ))
SymbolicObj2
| ExtrudeOnEdgeOf SymbolicObj2 SymbolicObj2
deriving Show
type Rectilinear2 = [Box2]
type Rectilinear3 = [Box3]