{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
module Shape.Data
    where
import Geometry.Data

import Control.Lens
type Shape = [ShapeObj]
_shVertices :: Shape -> [ShapeV]
{-# INLINE _shVertices #-}
_shVertices = concatMap _shVs

shVList :: Shape -> [ShapeV]
{-# INLINE shVList #-}
shVList = _shVertices
--shVList = DL.toList . _shVertices

{-# INLINE shVfromList #-}
shVfromList = id
--shVfromList = DL.fromList
{-# INLINE shEfromList #-}
shEfromList = id
--shEfromList = DL.fromList

data ShapeObj = ShapeObj 
    { _shType :: ShapeType 
    , _shVs :: [ShapeV]
    }

newtype ShapeType = TopPrism Int

-- edges are given by four consecutive points
data ShapeV = ShapeV
    {_svPos :: Point3
    ,_svCol :: Point4
    }
pairToSV :: (Point3,Point4) -> ShapeV
{-# INLINE pairToSV #-}
pairToSV = uncurry ShapeV
makeLenses ''ShapeV
