[OpenSCAD] "empty" openscad model?

doug moen doug at moens.org
Tue Apr 14 14:35:28 EDT 2015


I'm not sure if there is a correct answer. I'm not sure if the openscad
geometric operations are mathematically consistent for edge cases like
passing the empty model as an argument.

Mathematically, a 3D shape is a set of points, and the empty shape is the
empty set. So you would expect union(X, empty) = X, intersection(X, empty)
= empty.

In principle, i'd expect cube(0) and group(){} to both behave as the empty
shape, but in practice, they give different results when passed to
intersection. cube(0) behaves as expected, while
intersection(){cube(1);group(){}} returns cube(1).

So I guess that "box 0 0 0" is a reasonable choice.

On 14 April 2015 at 12:35, Mike Meyer <mwm at mired.org> wrote:

> I've turning my Haskell OpenSCAD model types into instances of Semigroup
> and Monoid, but wonder if I've chosen the right "empty" value for monoids.
>
> For those not familiar with it, a monoid is a structure that has an
> operation (in this case, union) with an identity object, empty.  The idea
> is that a union of anything with empty should return that same thing.
>
> Is there a convenient such object in OpenSCAD? I just used "box 0 0 0",
> which seems to do the right thing, but it feels like there ought to be a
> better option for "I need to return an object here, but don't really want
> to."
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20150414/f79c3a1e/attachment-0002.html>


More information about the Discuss mailing list