{-# LANGUAGE OverloadedStrings #-}

module Graphics.Formats.STL.Types
       (
           STL(..),
           Triangle(..),
           Vector,
           triple,
       ) where

import qualified Data.ByteString as BS

-- | A representation of an STL file, consisting of a (possibly empty)
-- object name, and a list of triangles.
data STL = STL
    { STL -> ByteString
name      :: BS.ByteString
    , STL -> [Triangle]
triangles :: [Triangle]
    }

-- | A single triangle in STL is represented by a normal vector and
-- three vertices.
data Triangle = Triangle
    { Triangle -> Maybe Vector
normal   :: Maybe Vector
    , Triangle -> (Vector, Vector, Vector)
vertices :: (Vector, Vector, Vector)
    }

type Vector = (Float, Float, Float)

triple :: a -> a -> a -> (a, a, a)
triple :: a -> a -> a -> (a, a, a)
triple a
a a
b a
c = (a
a, a
b, a
c)