[Haskell-cafe] ANN: mecha-0.0.2

Tom Hawkins tomahawkins at gmail.com
Sun Nov 1 10:55:19 EST 2009


> Neat!  What a cool idea.
>
>> data Solid = Solid (Vector -> Bool)
>
> With a type like this, how is it possible to make solids without hard edges?

Now the only way is to create a new primitive.  In the future I want
to have blended versions of the set operations to apply fillets or
bevels at the joints.  But I'm not sure how to do this yet.

> Why did you choose a monadic interface?  Is there a technical or
> semantic problem with a statement like:

I was originally thinking a monad would be needed to prevent
re-meshing difference instances of the same solid, as well has to
generate a bill-of-materials, 2D prints, etc.  But you're right, I
don't think it's needed.  Thanks.  See mecha-0.0.2:

example :: IO ()
example = view design

design :: Asm
design = assemble
  [                   color (0, 0, 0.8) $ place 1   0.06 8 $
difference sphereCube cyl3
  , move (-4, 0, 0) $ color (0.8, 0, 0) $ place 1   0.08 8 $ sphereCube
  , move ( 0, 4, 0) $ color (0, 0.8, 0) $ place 1.5 0.08 8 $ cyl3
  ]

sphereCube = intersection sphere $ scaleXYZ 0.75 cube
cyl = scale (0.5, 0.5, 1.2) $ cylinder
cyl3 = unions [cyl, rotateX (pi / 2) cyl, rotateY (pi / 2) cyl]


More information about the Haskell-Cafe mailing list