add basic geometric data types
This commit is contained in:
94
src/Model.hs
94
src/Model.hs
@@ -13,7 +13,93 @@ data Model = Model
|
|||||||
{ counter :: Integer
|
{ counter :: Integer
|
||||||
}
|
}
|
||||||
|
|
||||||
-- DEFAULTS --
|
-- absolute objects
|
||||||
model = Model
|
|
||||||
{ counter = 0
|
data AbsoluteObject
|
||||||
}
|
= AbsoluteObject [AbsoluteObject]
|
||||||
|
| AbsolutePoint Point
|
||||||
|
| PinnedRelativeObject Point RelativeObject
|
||||||
|
|
||||||
|
data Point
|
||||||
|
= Point
|
||||||
|
{ x :: Float
|
||||||
|
, y :: Float
|
||||||
|
, z :: Float
|
||||||
|
, k :: Float
|
||||||
|
}
|
||||||
|
|
||||||
|
data Line
|
||||||
|
= Line Point Point
|
||||||
|
|
||||||
|
data Triangle
|
||||||
|
= Triangle Point Point Point
|
||||||
|
|
||||||
|
-- relative objects
|
||||||
|
|
||||||
|
data RelativeObject
|
||||||
|
= RelativeObject [RelativeObject]
|
||||||
|
| RelativeHVolume HVolume
|
||||||
|
| RelativeVolume Volume
|
||||||
|
| RelativeSurface Surface
|
||||||
|
|
||||||
|
data HVolume
|
||||||
|
= HSphere Float
|
||||||
|
| HPrism Float Volume
|
||||||
|
|
||||||
|
data Volume
|
||||||
|
= Sphere Float
|
||||||
|
| Prism Float Surface
|
||||||
|
|
||||||
|
data Surface
|
||||||
|
= Circle Float
|
||||||
|
| Square Float
|
||||||
|
|
||||||
|
-- CONSTRUCTORS --
|
||||||
|
|
||||||
|
model :: Model
|
||||||
|
model =
|
||||||
|
Model
|
||||||
|
{ counter = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
-- absolutes
|
||||||
|
|
||||||
|
point :: Point
|
||||||
|
point =
|
||||||
|
Point
|
||||||
|
{ x = 0
|
||||||
|
, y = 0
|
||||||
|
, z = 0
|
||||||
|
, k = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
origin :: Point
|
||||||
|
origin = point
|
||||||
|
|
||||||
|
line :: Line
|
||||||
|
line = Line point point
|
||||||
|
|
||||||
|
triangle :: Triangle
|
||||||
|
triangle = Triangle point point point
|
||||||
|
|
||||||
|
-- relatives
|
||||||
|
|
||||||
|
hSphere :: HVolume
|
||||||
|
hSphere = HSphere 1
|
||||||
|
|
||||||
|
hPrism :: HVolume
|
||||||
|
hPrism = HPrism 1 prism
|
||||||
|
|
||||||
|
-- Volumes
|
||||||
|
|
||||||
|
sphere :: Volume
|
||||||
|
sphere = Sphere 1
|
||||||
|
|
||||||
|
prism :: Volume
|
||||||
|
prism = Prism 1 square
|
||||||
|
|
||||||
|
circle :: Surface
|
||||||
|
circle = Circle 1
|
||||||
|
|
||||||
|
square :: Surface
|
||||||
|
square = Square 1
|
||||||
|
|||||||
Reference in New Issue
Block a user