module Language.Mecha.Primitive ( sphere --, cube --, cone ) where import Language.Mecha.Solid sphere :: Solid sphere = primitive f where f (x, y, z) r | rFar < 1 = PrimInside | rNear > 1 = PrimOutside | otherwise = PrimSurface x y z where rNear = sqrt ((abs x - r) ** 2 + (abs y - r) ** 2 + (abs z - r) ** 2) rFar = sqrt ((abs x + r) ** 2 + (abs y + r) ** 2 + (abs z + r) ** 2)