Add shading for shapes and the floor

This commit is contained in:
2023-03-15 18:24:09 +00:00
parent 21f87b96d8
commit 989140d46e
16 changed files with 158 additions and 69 deletions
+3
View File
@@ -113,6 +113,9 @@ grahamEliminate xs = xs
centroid :: Foldable t => t Point2 -> Point2
centroid = L.fold $ (/) <$> L.Fold (+.+) (V2 0 0) id <*> L.genericLength
centroidNum :: (Fractional a ,Foldable t) => t a -> a
centroidNum = L.fold $ (/) <$> L.Fold (+) 0 id <*> L.genericLength
shrinkPolyOnEdges :: Float -> [Point2] -> [Point2]
shrinkPolyOnEdges x (p:q:ps) = map (shrinkVert x) . slideWindow 3 $ (p:q:ps) ++ [p,q]
shrinkPolyOnEdges _ _ = error "too few vertices in polygon"