Minor cleanups

This commit is contained in:
2022-02-10 10:50:29 +00:00
parent 0a860e6f68
commit 700ab8d930
8 changed files with 26 additions and 36 deletions
+5 -10
View File
@@ -55,16 +55,12 @@ upperPrismPoly
-> [Point2]
-> Shape
{-# INLINE upperPrismPoly #-}
upperPrismPoly h ps = [ShapeObj (TopPrism n) (f upps downps)]
upperPrismPoly h ps = [ShapeObj (TopPrism n) (f ps)]
where
n = length ps
upps = map f' ps
downps = map f'' ps
f (a:as) (b:bs) = a:b:f as bs
f [] _ = []
f _ [] = []
f' (V2 x y) = pairToSV (V3 x y h, black)
f'' (V2 x y) = pairToSV (V3 x y 0, black)
g h' (V2 x y) = pairToSV (V3 x y h', black)
f (x:xs) = g h x : g 0 x : f xs
f _ = []
upperPrismPolyHalf
:: Float -- ^ height, expected to be strictly positive
@@ -77,8 +73,7 @@ upperPrismPolyHalf h ps = [ShapeObj (TopPrism n) (f upps downps)]
upps = map f' ps
downps = map f'' ps
f (a:as) (b:bs) = a:b:f as bs
f [] _ = []
f _ [] = []
f _ _ = []
f' (V2 x y) = pairToSV (V3 (0.5 * x) (0.5 * y) h, black)
f'' (V2 x y) = pairToSV (V3 x y 0, black)