diff --git a/Examples/example11.hs b/Examples/example11.hs index 9d2bef4..9ef62ca 100644 --- a/Examples/example11.hs +++ b/Examples/example11.hs @@ -2,8 +2,8 @@ import Graphics.Implicit out = union [ - squareR 0 True (80, 80) - , translate (40, 40) $ circle 30 + square True (V2 80 80) + , translate (V2 40 40) $ circle 30 ] main = writeSVG 2 "example11.svg" out diff --git a/Examples/example12.hs b/Examples/example12.hs index 763cbb1..e97b272 100644 --- a/Examples/example12.hs +++ b/Examples/example12.hs @@ -1,9 +1,10 @@ -- Example 12 - the rounded union of a square and a circle. +import Control.Applicative (pure) import Graphics.Implicit out = unionR 14 [ - squareR 0 (80, 80) - , translate (40,40) $ circle 30 + square True (pure 80) -- pure 80 turns into (V2 80 80) + , translate (pure 40) $ circle 30 ] main = writeSVG 2 "example12.svg" out diff --git a/Examples/example13.hs b/Examples/example13.hs index 5c586bc..b48ce85 100644 --- a/Examples/example13.hs +++ b/Examples/example13.hs @@ -1,9 +1,10 @@ -- Example 13 - the rounded union of a cube and a sphere. +import Control.Applicative (pure) import Graphics.Implicit out = union [ - cubeR 0 False (20, 20, 20) - , translate (20, 20, 20) $ sphere 15 + cube False (pure 20) -- same as (V3 20 20 20) + , translate (pure 20) $ sphere 15 ] main = writeSTL 1 "example13.stl" out diff --git a/Examples/example16.hs b/Examples/example16.hs index e2f0a1d..425d141 100644 --- a/Examples/example16.hs +++ b/Examples/example16.hs @@ -1,8 +1,12 @@ +import Control.Applicative (pure) import Graphics.Implicit import Graphics.Implicit.Definitions import Graphics.Implicit.Primitives roundbox:: SymbolicObj3 -roundbox = implicit (\(x,y,z) -> x^4 + y^4 + z^4 - 15000) ((-20,-20,-20),(20,20,20)) +roundbox = + implicit + (\(V3 x y z) -> x^4 + y^4 + z^4 - 15000) + (pure (-20), pure 20) main = writeSTL 2 "example16.stl" roundbox diff --git a/Examples/example17.hs b/Examples/example17.hs index 7a069c8..5517550 100644 --- a/Examples/example17.hs +++ b/Examples/example17.hs @@ -1,22 +1,25 @@ -- Example 17, pulled from our benchmarking suite. -import Prelude ((<$>), ($), zip3, fmap, fromIntegral, (*), (/)) -import Graphics.Implicit (union, translate, rect3R, writeSTL) +import Control.Applicative (pure) +import Prelude ((<$>), ($), zipWith3, fmap, fromIntegral, (*), (/), Bool(..)) +import Graphics.Implicit (cube, union, translate, writeSTL, V3(..)) import Graphics.Implicit.Definitions (Fastℕ, ℝ, ℝ3, SymbolicObj3) default (Fastℕ, ℝ) object2 :: SymbolicObj3 -object2 = squarePipe (10, 10, 10) 1 100 +object2 = squarePipe (pure 10) 1 100 where squarePipe :: ℝ3 -> ℝ -> ℝ -> SymbolicObj3 - squarePipe (x,y,z) diameter precision = + squarePipe (V3 x y z) diameter precision = union ((\start -> translate start - $ cubeR 0 False (diameter, diameter, diameter) + $ cube True (pure diameter) ) <$> - zip3 (fmap (\n -> (fromIntegral n / precision) * x) [0..100]) - (fmap (\n -> (fromIntegral n / precision) * y) [0..100]) - (fmap (\n -> (fromIntegral n / precision) * z) [0..100])) + zipWith3 + V3 + (fmap (\n -> (fromIntegral n / precision) * x) [0..100]) + (fmap (\n -> (fromIntegral n / precision) * y) [0..100]) + (fmap (\n -> (fromIntegral n / precision) * z) [0..100])) main = writeSTL 1 "example17.stl" object2