ImplicitCAD/Examples/example17.hs

23 lines
873 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
default (Fast, )
object2 :: SymbolicObj3
object2 = squarePipe (10, 10, 10) 1 100
2019-06-06 09:58:14 +03:00
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
((\start -> translate start
$ cubeR 0 False (diameter, diameter, diameter)
2019-12-31 20:18:25 +03:00
)
<$>
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]))
2019-06-06 09:58:14 +03:00
main = writeSTL 1 "example17.stl" object2