Turn Shape into a stream
This commit is contained in:
+5
-5
@@ -25,7 +25,7 @@ import qualified Data.Vector.Fusion.Stream.Monadic as VS
|
||||
|
||||
emptySH :: Shape
|
||||
{-# INLINE emptySH #-}
|
||||
emptySH = mempty
|
||||
emptySH = VS.empty
|
||||
|
||||
-- - approximate a circle by a polygon with n*2 points of radius x
|
||||
polyCirc :: Int -> Float -> [Point2]
|
||||
@@ -45,7 +45,7 @@ prismPoly
|
||||
-> [Point3]
|
||||
-> Shape
|
||||
{-# INLINE prismPoly #-}
|
||||
prismPoly upps downps = [ShapeObj (TopPrism n) (VS.fromList $ f upps downps)]
|
||||
prismPoly upps downps = VS.singleton $ ShapeObj (TopPrism n) (VS.fromList $ f upps downps)
|
||||
where
|
||||
n = length upps
|
||||
f (a:as) (b:bs) = g a:g b:f as bs
|
||||
@@ -58,7 +58,7 @@ upperPrismPoly
|
||||
-> [Point2]
|
||||
-> Shape
|
||||
{-# INLINE upperPrismPoly #-}
|
||||
upperPrismPoly h ps = [ShapeObj (TopPrism n) (VS.fromList $ f ps)]
|
||||
upperPrismPoly h ps = VS.singleton $ ShapeObj (TopPrism n) (VS.fromList $ f ps)
|
||||
where
|
||||
n = length ps
|
||||
g h' (V2 x y) = pairToSV (V3 x y h', black)
|
||||
@@ -70,7 +70,7 @@ upperPrismPolyHalf
|
||||
-> [Point2]
|
||||
-> Shape
|
||||
{-# INLINE upperPrismPolyHalf #-}
|
||||
upperPrismPolyHalf h ps = [ShapeObj (TopPrism n) (VS.fromList $ f upps downps)]
|
||||
upperPrismPolyHalf h ps = VS.singleton $ ShapeObj (TopPrism n) (VS.fromList $ f upps downps)
|
||||
where
|
||||
n = length ps
|
||||
upps = map f' ps
|
||||
@@ -94,7 +94,7 @@ overColSH = fmap . overColObj
|
||||
|
||||
overPosSHI :: (Point3 -> Point3) -> Shape -> Shape
|
||||
{-# INLINE overPosSHI #-}
|
||||
overPosSHI = fmap . overPosObj
|
||||
overPosSHI = VS.map . overPosObj
|
||||
|
||||
translateSH :: Point3 -> Shape -> Shape
|
||||
{-# INLINE translateSH #-}
|
||||
|
||||
Reference in New Issue
Block a user