26 lines
972 B
Haskell
26 lines
972 B
Haskell
{-# LANGUAGE TemplateHaskell #-}
|
|
--{-# LANGUAGE Strict #-}
|
|
module Polyhedra.Data
|
|
where
|
|
import Geometry.Data
|
|
|
|
import Control.Lens
|
|
import qualified Data.Map as M
|
|
--import qualified Data.IntSet as IS
|
|
-- | Polyhedra are represented as a list of faces.
|
|
-- Each face is a list of points (and colours) that are assumed to lie on a plane, and be
|
|
-- ordered to form an anticlockwise convex polygon within that plane.
|
|
newtype Polyhedra = Polyhedron
|
|
{ _pyFaces :: [[(Point3,Point4)]]
|
|
}
|
|
-- | Describe a polygon as a map from vertex indices to a positioning and list of faces.
|
|
-- The list of faces is assumed to be ordered in clockwise direction around the vertex.
|
|
-- The vertices of the faces are assumed to start with a point adjacent to the
|
|
-- key vertex and to be listed anticlockwise around the center of the face.
|
|
-- The key vertex is not included in the list.
|
|
newtype VF a = VF
|
|
{ _vertices :: M.Map a (Point3, [[a]])
|
|
}
|
|
makeLenses ''Polyhedra
|
|
makeLenses ''VF
|