From 2b74224ea11c54107ee49f666afbaa4650714ec5 Mon Sep 17 00:00:00 2001 From: Julia Longtin Date: Thu, 6 Jun 2019 07:58:14 +0100 Subject: [PATCH] two more examples. --- Examples/example16.hs | 8 ++++++++ Examples/example17.hs | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Examples/example16.hs create mode 100644 Examples/example17.hs diff --git a/Examples/example16.hs b/Examples/example16.hs new file mode 100644 index 0000000..08e84cc --- /dev/null +++ b/Examples/example16.hs @@ -0,0 +1,8 @@ +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)) + +main = writeSTL 2 "example16.stl" roundbox diff --git a/Examples/example17.hs b/Examples/example17.hs new file mode 100644 index 0000000..ebd23ed --- /dev/null +++ b/Examples/example17.hs @@ -0,0 +1,21 @@ +-- Example 17, pulled from our benchmarking suite. +import Graphics.Implicit +import Graphics.Implicit.Definitions + +default (Fastℕ, ℝ) + +object2 :: SymbolicObj3 +object2 = squarePipe (10,10,10) 1 100 + where + squarePipe :: (ℝ,ℝ,ℝ) -> ℝ -> ℝ -> SymbolicObj3 + squarePipe (x,y,z) diameter precision = + union + $ map (\start-> translate start + $ rect3R 0 (0,0,0) (diameter,diameter,diameter) + ) + $ zip3 (map (\n->((fromIntegral n)/precision)*x) [0..100]) + (map (\n->((fromIntegral n)/precision)*y) [0..100]) + (map (\n->((fromIntegral n)/precision)*z) [0..100]) + +main = writeSTL 1 "example17.stl" object2 +