two more examples.

This commit is contained in:
Julia Longtin 2019-06-06 07:58:14 +01:00
parent 9dcebd719d
commit 2b74224ea1
2 changed files with 29 additions and 0 deletions

8
Examples/example16.hs Normal file
View File

@ -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

21
Examples/example17.hs Normal file
View File

@ -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