Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: fb38f996ce
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (15 sloc) 0.548 kB
module Language.Mecha.Primitives
( sphere
, cube
, cylinder
) where
import Language.Mecha.Solid
-- | A sphere with radius 1 centered at origin.
sphere :: Solid
sphere = Solid $ \ (x, y, z) -> sqrt (x ** 2 + y ** 2 + z ** 2) <= 1
-- | A sphere with edge length 2 centered at origin.
cube :: Solid
cube = Solid $ \ (x, y, z) -> all (\ a -> a <= 1 && a >= (-1)) [x, y, z]
-- | A cylinder with radius 1 and height 2 centered at origin.
cylinder :: Solid
cylinder = Solid $ \ (x, y, z) -> z <= 1 && z >= (-1) && sqrt (x ** 2 + y ** 2) <= 1
Jump to Line
Something went wrong with that request. Please try again.