module Irg.Lab4.Shading.PolygonUtility where
  
  import Linear
  
  getPolyNormal :: [V4 Float] -> V4 Float
  getPolyNormal [d1, d2, d3] = normalize $ (d1 - d2) `crossV4` (d1 - d3)
  
  crossV4 :: V4 Float -> V4 Float -> V4 Float
  crossV4 a b = vector $ normalizePoint a `cross` normalizePoint b
  
  getPolyCenter :: [V4 Float] -> V4 Float
  getPolyCenter [d1, d2, d3] = (d1 + d2 + d3) / 3
  
  