You are viewing a single comment's thread. Return to all comments →
distance :: [Int] -> [Int] -> Float distance a b = sqrt $ fromIntegral ((((a !! 0) - (b !! 0)) ^ 2) + (((a !! 1) - (b !! 1)) ^ 2)) perimeter :: Int -> Int -> Int -> [[Int]] -> Float perimeter i j n lst | i >= n = 0 | otherwise = (perimeter ( i + 1 ) i n lst) + distance (lst !! i) (lst !! j)
Seems like cookies are disabled on this browser, please enable them to open this website
Compute the Perimeter of a Polygon
You are viewing a single comment's thread. Return to all comments →