Reset Shapes to be list (not stream) of ShapeObj
This commit is contained in:
+11
-5
@@ -23,6 +23,12 @@ import Shape.Data
|
||||
import Color
|
||||
import qualified Streaming.Prelude as S
|
||||
|
||||
singleShape :: ShapeObj -> Shape
|
||||
{-# INLINE singleShape #-}
|
||||
singleShape = (:[])
|
||||
|
||||
shMap = map
|
||||
|
||||
emptySH :: Shape
|
||||
{-# INLINE emptySH #-}
|
||||
emptySH = mempty
|
||||
@@ -45,7 +51,7 @@ prismPoly
|
||||
-> [Point3]
|
||||
-> Shape
|
||||
{-# INLINE prismPoly #-}
|
||||
prismPoly upps downps = S.yield (ShapeObj (TopPrism n) (f upps downps))
|
||||
prismPoly upps downps = singleShape (ShapeObj (TopPrism n) (f upps downps))
|
||||
where
|
||||
n = length upps
|
||||
f (a:as) (b:bs) = g a:g b:f as bs
|
||||
@@ -58,7 +64,7 @@ upperPrismPoly
|
||||
-> [Point2]
|
||||
-> Shape
|
||||
{-# INLINE upperPrismPoly #-}
|
||||
upperPrismPoly h ps = S.yield (ShapeObj (TopPrism n) (f ps))
|
||||
upperPrismPoly h ps = singleShape (ShapeObj (TopPrism n) (f ps))
|
||||
where
|
||||
n = length ps
|
||||
g h' (V2 x y) = pairToSV (V3 x y h', black)
|
||||
@@ -70,7 +76,7 @@ upperPrismPolyHalf
|
||||
-> [Point2]
|
||||
-> Shape
|
||||
{-# INLINE upperPrismPolyHalf #-}
|
||||
upperPrismPolyHalf h ps = S.yield (ShapeObj (TopPrism n) (f upps downps))
|
||||
upperPrismPolyHalf h ps = singleShape (ShapeObj (TopPrism n) (f upps downps))
|
||||
where
|
||||
n = length ps
|
||||
upps = map f' ps
|
||||
@@ -86,7 +92,7 @@ colorSH = overColSH . const
|
||||
|
||||
overColSH :: (Point4 -> Point4) -> Shape -> Shape
|
||||
{-# INLINE overColSH #-}
|
||||
overColSH = S.map . overColObj
|
||||
overColSH = shMap . overColObj
|
||||
|
||||
translateSH :: Point3 -> Shape -> Shape
|
||||
{-# INLINE translateSH #-}
|
||||
@@ -106,7 +112,7 @@ rotateSH = overPosSH . rotate3
|
||||
|
||||
overPosSH :: (Point3 -> Point3) -> Shape -> Shape
|
||||
{-# INLINEABLE overPosSH #-}
|
||||
overPosSH = S.map . overPosObj
|
||||
overPosSH = shMap . overPosObj
|
||||
|
||||
rotateSHx :: Float -> Shape -> Shape
|
||||
{-# INLINE rotateSHx #-}
|
||||
|
||||
Reference in New Issue
Block a user