add basic geometric data types

This commit is contained in:
mtgmonkey
2025-11-27 22:27:31 +01:00
parent 1efda4fa44
commit 978ae2e725

View File

@@ -13,7 +13,93 @@ data Model = Model
{ counter :: Integer { counter :: Integer
} }
-- DEFAULTS -- -- absolute objects
model = Model
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 { 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