module CsgExample
( csgExample
) where 

import qualified Waterfall.Solids as Solids
import qualified Waterfall.Transforms as Transforms
import Waterfall.Booleans.Operators ( (~-~), (~/\~), (~\/~) )
import Linear (V3 (..), (^*), unit, _x, _y, _z )
import Data.Function ((&))

csgExample :: Solids.Solid
csgExample :: Solid
csgExample = let 
    sphere :: Solid
sphere = Solid
Solids.unitSphere
    cube :: Solid
cube = Double -> Solid -> Solid
forall a. Transformable a => Double -> a -> a
Transforms.uScale Double
1.5 Solid
Solids.centeredCube
    cylinder :: Solid
cylinder = Solid
Solids.unitCylinder Solid -> (Solid -> Solid) -> Solid
forall a b. a -> (a -> b) -> b
&
         V3 Double -> Solid -> Solid
forall a. Transformable a => V3 Double -> a -> a
Transforms.translate (ASetter' (V3 Double) Double -> V3 Double
forall (t :: * -> *) a.
(Additive t, Num a) =>
ASetter' (t a) a -> t a
unit ASetter' (V3 Double) Double
forall a. Lens' (V3 a) a
forall (t :: * -> *) a. R3 t => Lens' (t a) a
_z V3 Double -> Double -> V3 Double
forall (f :: * -> *) a. (Functor f, Num a) => f a -> a -> f a
^* (-Double
0.5)) Solid -> (Solid -> Solid) -> Solid
forall a b. a -> (a -> b) -> b
&
         V3 Double -> Solid -> Solid
forall a. Transformable a => V3 Double -> a -> a
Transforms.scale (Double -> Double -> Double -> V3 Double
forall a. a -> a -> a -> V3 a
V3 Double
0.55 Double
0.55 Double
4) 
    cylinderA :: Solid
cylinderA = V3 Double -> Double -> Solid -> Solid
forall a. Transformable a => V3 Double -> Double -> a -> a
Transforms.rotate (ASetter' (V3 Double) Double -> V3 Double
forall (t :: * -> *) a.
(Additive t, Num a) =>
ASetter' (t a) a -> t a
unit ASetter' (V3 Double) Double
forall a. Lens' (V3 a) a
forall (t :: * -> *) a. R1 t => Lens' (t a) a
_x) (Double
forall a. Floating a => a
piDouble -> Double -> Double
forall a. Fractional a => a -> a -> a
/Double
2) Solid
cylinder
    cylinderB :: Solid
cylinderB = V3 Double -> Double -> Solid -> Solid
forall a. Transformable a => V3 Double -> Double -> a -> a
Transforms.rotate (ASetter' (V3 Double) Double -> V3 Double
forall (t :: * -> *) a.
(Additive t, Num a) =>
ASetter' (t a) a -> t a
unit ASetter' (V3 Double) Double
forall a. Lens' (V3 a) a
forall (t :: * -> *) a. R2 t => Lens' (t a) a
_y) (Double
forall a. Floating a => a
piDouble -> Double -> Double
forall a. Fractional a => a -> a -> a
/Double
2) Solid
cylinder
  in (Solid
cube Solid -> Solid -> Solid
~/\~ Solid
sphere) Solid -> Solid -> Solid
~-~ (Solid
cylinder Solid -> Solid -> Solid
~\/~ Solid
cylinderA Solid -> Solid -> Solid
~\/~ Solid
cylinderB)