mirror of
https://github.com/Haskell-Things/ImplicitCAD.git
synced 2024-09-11 04:55:41 +03:00
two more examples.
This commit is contained in:
parent
9dcebd719d
commit
2b74224ea1
8
Examples/example16.hs
Normal file
8
Examples/example16.hs
Normal 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
21
Examples/example17.hs
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user