All compile errors fixed, but now there's a weird NaN. The wonders never cease

This commit is contained in:
2023-01-30 21:40:58 +01:00
parent e45fab1389
commit cf300f3f88
7 changed files with 179 additions and 37 deletions

View File

@@ -15,7 +15,8 @@ rmsSize' :: Floating a => V2 a -> [V2 a] -> a
rmsSize' centroid = sqrt . uncurry (/) . foldl1' (bimap2 (+) (+)) . map (quadrance . (^-^ centroid) &&& (const 1))
rmsSize :: Floating a => [V2 a] -> a
rmsSize = centroid >>= rmsSize'
rmsSize [] = 1/0
rmsSize points = rmsSize' (centroid points) points
centroid :: Fractional a => [V2 a] -> V2 a
centroid = uncurry (^/) . foldl1' (bimap2 (^+^) (+)) . map (flip (,) 1)