{-# LANGUAGE UnicodeSyntax #-}
module GraphRewriting.Layout.Geometry where

import Data.Vector.V2


focalPoint  [Vector2]  Vector2
focalPoint :: [Vector2] -> Vector2
focalPoint [] = [Char] -> Vector2
forall a. HasCallStack => [Char] -> a
error [Char]
"focalPoint []"
focalPoint [Vector2]
xs = [Vector2] -> Vector2
forall a. Fractional a => [a] -> a
average [Vector2]
xs

average  Fractional a  [a]  a
average :: forall a. Fractional a => [a] -> a
average [] = Integer -> a
forall a. Num a => Integer -> a
fromInteger Integer
0
average [a]
xs = [a] -> a
forall a. Num a => [a] -> a
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum [a]
xs a -> a -> a
forall a. Fractional a => a -> a -> a
/ Int -> a
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([a] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [a]
xs)