module Geometry.Data
    ( module Geometry.Data
    , V2 (..)
    , V3 (..)
    , V4 (..)
    )
    where
import Linear.V2
import Linear.V3
import Linear.V4
type Int2   = V2 Int
type Point2 = V2 Float
type Point3 = V3 Float
type Point4 = V4 Float

type DPoint2 = (Point2,Float)

toV2 :: (a,a) -> V2 a
toV2 (a,b)      = V2 a b
toV3 :: (a,a,a) -> V3 a
toV3 (a,b,c)    = V3 a b c
toV4 :: (a,a,a,a) -> V4 a
toV4 (a,b,c,d)  = V4 a b c d

fromV3 :: V3 a -> (a,a,a)
fromV3 (V3 a b c) = (a,b,c)

uncurryV :: (a -> a -> b) -> V2 a -> b
{-# INLINE uncurryV #-}
uncurryV f (V2 x y) = f x y

fstV2 :: V2 a -> a
fstV2 (V2 x _) = x
sndV2 :: V2 a -> a
sndV2 (V2 _ x) = x
