diff --git a/Examples/example11.hs b/Examples/example11.hs index bd4a660..9d2bef4 100644 --- a/Examples/example11.hs +++ b/Examples/example11.hs @@ -2,8 +2,9 @@ import Graphics.Implicit out = union [ - rectR 0 (-40,-40) (40,40), - translate (40,40) (circle 30) ] + squareR 0 True (80, 80) + , translate (40, 40) $ circle 30 + ] main = writeSVG 2 "example11.svg" out diff --git a/Examples/example12.hs b/Examples/example12.hs index 09d63c3..763cbb1 100644 --- a/Examples/example12.hs +++ b/Examples/example12.hs @@ -2,7 +2,8 @@ import Graphics.Implicit out = unionR 14 [ - rectR 0 (-40,-40) (40,40), - translate (40,40) (circle 30) ] + squareR 0 (80, 80) + , translate (40,40) $ circle 30 + ] main = writeSVG 2 "example12.svg" out diff --git a/Examples/example13.hs b/Examples/example13.hs index 875147b..5c586bc 100644 --- a/Examples/example13.hs +++ b/Examples/example13.hs @@ -2,7 +2,8 @@ import Graphics.Implicit out = union [ - rect3R 0 (0,0,0) (20,20,20), - translate (20,20,20) (sphere 15) ] + cubeR 0 False (20, 20, 20) + , translate (20, 20, 20) $ sphere 15 + ] main = writeSTL 1 "example13.stl" out diff --git a/Examples/example17.hs b/Examples/example17.hs index 74e552e..7a069c8 100644 --- a/Examples/example17.hs +++ b/Examples/example17.hs @@ -3,22 +3,20 @@ import Prelude ((<$>), ($), zip3, fmap, fromIntegral, (*), (/)) import Graphics.Implicit (union, translate, rect3R, writeSTL) import Graphics.Implicit.Definitions (Fastℕ, ℝ, ℝ3, SymbolicObj3) - default (Fastℕ, ℝ) object2 :: SymbolicObj3 -object2 = squarePipe (10,10,10) 1 100 +object2 = squarePipe (10, 10, 10) 1 100 where squarePipe :: ℝ3 -> ℝ -> ℝ -> SymbolicObj3 squarePipe (x,y,z) diameter precision = union - ((\start-> translate start - $ rect3R 0 (0,0,0) (diameter,diameter,diameter) + ((\start -> translate start + $ cubeR 0 False (diameter, diameter, 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])) + 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])) main = writeSTL 1 "example17.stl" object2 - diff --git a/README.md b/README.md index 78f73c5..1fa048e 100644 --- a/README.md +++ b/README.md @@ -196,8 +196,9 @@ Everything you saw above can be done with the Haskell API. For example, a simple import Graphics.Implicit out = union [ - rectR 0 (-40,-40) (40,40), - translate (40,40) (circle 30) ] + squareR 0 True (80, 80) + , translate (40, 40) (circle 30) + ] main = writeSVG 2 "test.svg" out ``` @@ -212,8 +213,9 @@ A rounded union: import Graphics.Implicit out = unionR 14 [ - rectR 0 (-40,-40) (40,40), - translate (40,40) (circle 30) ] + squareR 0 True (80, 80) + , translate (80, 80) (circle 30) + ] main = writeSVG 2 "test.svg" out ``` @@ -227,8 +229,9 @@ A simple 3D example: import Graphics.Implicit out = union [ - rect3R 0 (0,0,0) (20,20,20), - translate (20,20,20) (sphere 15) ] + cubeR 0 False (20, 20, 20) + , translate (20, 20, 20) (sphere 15) + ] main = writeSTL 1 "test.stl" out ```