-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTakePathFractionExample.hs
More file actions
32 lines (30 loc) · 1.07 KB
/
Copy pathTakePathFractionExample.hs
File metadata and controls
32 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{-|
<<models/takePathFraction.glb>>
-}
module TakePathFractionExample
( takePathFractionExample
) where
import Waterfall.Sweep (sweep)
import Waterfall.Solids (Solid)
import qualified Waterfall.Path as Path
import qualified Waterfall.TwoD.Shape as Shape
import qualified Waterfall.Transforms as Transforms
import qualified Waterfall.TwoD.Transforms as TwoD.Transforms
import Linear (V3 (..), zero)
import Data.Function ((&))
takePathFractionExample :: Solid
takePathFractionExample =
let sweepPath = Path.pathFrom zero
[ Path.bezierRelative (V3 0 0 0.5) (V3 0.5 0.5 0.5) (V3 0.5 0.5 1)
, Path.bezierRelative (V3 0 0 0.5) (V3 (-0.5) (-0.5) 0.5) (V3 (-0.5) (-0.5) 1)
, Path.arcViaRelative (V3 0 1 1) (V3 0 2 0)
, Path.lineTo (V3 0 2 0)
]
profile = TwoD.Transforms.uScale2D 0.2 Shape.unitCircle
fractions = [0.1, 0.2 .. 1.0]
in mconcat
[ profile
& sweep (Path.takePathFraction3D f sweepPath)
& Transforms.translate (V3 (f * 10) 0 0)
| f <- fractions
]