[Haskell-cafe] ANN: mecha-0.0.1
lrpalmer at gmail.com
Sat Oct 31 19:53:40 EDT 2009
Neat! What a cool idea.
On Sat, Oct 31, 2009 at 5:27 PM, Tom Hawkins <tomahawkins at gmail.com> wrote:
> Mecha is a little solid modeling language intended for machine design.
> Mecha has two layers: a pure functional layer for defining solids
> (aka. parts), and a monadic layer for arranging parts into assemblies.
> Solids (parts) are built using set operations on solid primitives. A
> solid primitives is simply a predicate that says whether a point in
> space is inside the solid:
> data Solid = Solid (Vector -> Bool)
With a type like this, how is it possible to make solids without hard edges?
> Mesh generation is performed by adaptive marching cubes.
> It's slow, especially if you don't have graphics hardware. And solids
> with hard edges don't render very clean. But the basics work.
> Here's a simple example:
> example :: IO ()
> example = view design
> design :: Asm ()
> design = do
> a <- part 1 0.06 8 $ difference sphereCube cyl3
> b <- part 1 0.08 8 $ sphereCube
> c <- part 1.5 0.08 8 $ cyl3
> color (0, 0, 0.8) $ place a
> move (-4, 0, 0) $ color (0.8, 0, 0) $ place b
> move ( 0, 4, 0) $ color (0, 0.8, 0) $ place c
Why did you choose a monadic interface? Is there a technical or
semantic problem with a statement like:
let a = part 1 0.06 8 $ difference sphereCube cyl3
b = part 1 0.08 8 $ sphereCube
c = part 1.5 0.08 8 $ cyl3
in mconcat [ color (0, 0, 0.8) a
, move (-4, 0, 0) . color (0.8, 0, 0) $ b
, move (0, 4, 0) . color (0, 0.8, 0) $ b
More information about the Haskell-Cafe