ImplicitCAD/Examples/example17.hs
Richard Marko 6d4162e137 Tidy Haskell examples
Both in Examples dir and README.
2020-12-05 10:34:57 +01:00

23 lines
873 B
Haskell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Example 17, pulled from our benchmarking suite.
import Prelude ((<$>), ($), zip3, fmap, fromIntegral, (*), (/))
import Graphics.Implicit (union, translate, rect3R, writeSTL)
import Graphics.Implicit.Definitions (Fast, , 3, SymbolicObj3)
default (Fast, )
object2 :: SymbolicObj3
object2 = squarePipe (10, 10, 10) 1 100
where
squarePipe :: 3 -> -> -> SymbolicObj3
squarePipe (x,y,z) diameter precision =
union
((\start -> translate start
$ cubeR 0 False (diameter, diameter, diameter)
)
<$>
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]))
main = writeSTL 1 "example17.stl" object2