ImplicitCAD/Examples/example17.hs

25 lines
855 B
Haskell
Raw Normal View History

2019-06-06 09:58:14 +03:00
-- Example 17, pulled from our benchmarking suite.
import Prelude ((<$>), ($), zip3, fmap, fromIntegral, (*), (/))
2019-12-31 17:26:37 +03:00
import Graphics.Implicit (union, translate, rect3R, writeSTL)
import Graphics.Implicit.Definitions (Fast, , 3, SymbolicObj3)
2019-06-06 09:58:14 +03:00
2019-06-06 09:58:14 +03:00
default (Fast, )
object2 :: SymbolicObj3
object2 = squarePipe (10,10,10) 1 100
where
2019-12-31 17:26:37 +03:00
squarePipe :: 3 -> -> -> SymbolicObj3
2019-06-06 09:58:14 +03:00
squarePipe (x,y,z) diameter precision =
union
2019-12-31 20:18:25 +03:00
((\start-> translate start
$ rect3R 0 (0,0,0) (diameter,diameter,diameter)
)
<$>
zip3 (fmap (\n->(fromIntegral n/precision)*x) [0..100])
2019-12-26 16:03:55 +03:00
(fmap (\n->(fromIntegral n/precision)*y) [0..100])
(fmap (\n->(fromIntegral n/precision)*z) [0..100]))
2019-06-06 09:58:14 +03:00
main = writeSTL 1 "example17.stl" object2