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)
takePathFractionExample :: Solid
takePathFractionExample :: Solid
takePathFractionExample =
let sweepPath :: Path
sweepPath = V3 Double -> [V3 Double -> (V3 Double, Path)] -> Path
forall path point.
Monoid path =>
point -> [point -> (point, path)] -> path
Path.pathFrom V3 Double
forall a. Num a => V3 a
forall (f :: * -> *) a. (Additive f, Num a) => f a
zero
[ V3 Double
-> V3 Double -> V3 Double -> V3 Double -> (V3 Double, Path)
forall point path.
(AnyPath point path, Epsilon point) =>
point -> point -> point -> point -> (point, path)
Path.bezierRelative (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 Double
0 Double
0 Double
0.5) (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 Double
0.5 Double
0.5 Double
0.5) (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 Double
0.5 Double
0.5 Double
1)
, V3 Double
-> V3 Double -> V3 Double -> V3 Double -> (V3 Double, Path)
forall point path.
(AnyPath point path, Epsilon point) =>
point -> point -> point -> point -> (point, path)
Path.bezierRelative (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 Double
0 Double
0 Double
0.5) (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 (-Double
0.5) (-Double
0.5) Double
0.5) (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 (-Double
0.5) (-Double
0.5) Double
1)
, V3 Double -> V3 Double -> V3 Double -> (V3 Double, Path)
forall point path.
(AnyPath point path, Epsilon point) =>
point -> point -> point -> (point, path)
Path.arcViaRelative (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 Double
0 Double
1 Double
1) (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 Double
0 Double
2 Double
0)
, V3 Double -> V3 Double -> (V3 Double, Path)
forall point path.
(AnyPath point path, Epsilon point) =>
point -> point -> (point, path)
Path.lineTo (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 Double
0 Double
2 Double
0)
]
profile :: Shape
profile = Double -> Shape -> Shape
forall a. Transformable2D a => Double -> a -> a
TwoD.Transforms.uScale2D Double
0.2 Shape
Shape.unitCircle
fractions :: [Double]
fractions = [Double
0.1, Double
0.2 .. Double
1.0]
in [Solid] -> Solid
forall a. Monoid a => [a] -> a
mconcat
[ V3 Double -> Solid -> Solid
forall a. Transformable a => V3 Double -> a -> a
Transforms.translate (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 (Double
f Double -> Double -> Double
forall a. Num a => a -> a -> a
* Double
10) Double
0 Double
0) (Solid -> Solid) -> (Shape -> Solid) -> Shape -> Solid
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path -> Shape -> Solid
sweep (Double -> Path -> Path
Path.takePathFraction3D Double
f Path
sweepPath) (Shape -> Solid) -> Shape -> Solid
forall a b. (a -> b) -> a -> b
$ Shape
profile
| Double
f <- [Double]
fractions
]