Minkowski with more than child 2 objects

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Minkowski with more than child 2 objects

cacb
In the OpenSCAD documentation for minkowski(), examples are given for 2
child objects, ref:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#minkowski

But what if you supply 3 or more, for example:

$fn=50;
minkowski()
{
     cube([10,10,10]);
     cylinder(r=2,h=10);
     sphere(r=4);
}

This seems to be accepted, but it is not obvious what happens in this
case. It looks like the same as below?

$fn=50;
minkowski()
{
     minkowski() {
         cube([10,10,10]);
         cylinder(r=2,h=10);
     }
     sphere(r=4);
}

In other words, when more than 2 child objects are supplied the child
objects are subject to a series of implicit minkowski operations until
the list is exhausted. Is this a correct interpretation?


Carsten Arnholm

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Minkowski with more than child 2 objects

nophead
I don't think the order matters does it? Basically the result is the set with all combinations of points added together.

On 18 March 2018 at 11:41, Carsten Arnholm <[hidden email]> wrote:
In the OpenSCAD documentation for minkowski(), examples are given for 2 child objects, ref: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#minkowski

But what if you supply 3 or more, for example:

$fn=50;
minkowski()
{
    cube([10,10,10]);
    cylinder(r=2,h=10);
    sphere(r=4);
}

This seems to be accepted, but it is not obvious what happens in this case. It looks like the same as below?

$fn=50;
minkowski()
{
    minkowski() {
        cube([10,10,10]);
        cylinder(r=2,h=10);
    }
    sphere(r=4);
}

In other words, when more than 2 child objects are supplied the child objects are subject to a series of implicit minkowski operations until the list is exhausted. Is this a correct interpretation?


Carsten Arnholm

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Minkowski with more than child 2 objects

kintel
Administrator
In reply to this post by cacb
On Mar 18, 2018, at 7:41 AM, Carsten Arnholm <[hidden email]> wrote:
>
> In other words, when more than 2 child objects are supplied the child objects are subject to a series of implicit minkowski operations until the list is exhausted. Is this a correct interpretation?
>
Nophead is right: Minkowski sums are commutative, but they’re implemented by accumulating binary sums as you describe.

The exception is if all operators are convex. In that case we can exploit the fact that the "convex hulls of a minkowski sum” equals the “minkowski sum of convex hulls”. ..and simply collect vertices and calculate a single convex hull:
https://en.wikipedia.org/wiki/Minkowski_addition

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Minkowski with more than child 2 objects

cacb
On 18. mars 2018 14:52, Marius Kintel wrote:
> Nophead is right: Minkowski sums are commutative, but they’re implemented by accumulating binary sums as you describe.
>
> The exception is if all operators are convex. In that case we can exploit the fact that the "convex hulls of a minkowski sum” equals the “minkowski sum of convex hulls”. ..and simply collect vertices and calculate a single convex hull:
> https://en.wikipedia.org/wiki/Minkowski_addition

Thanks, that makes it clearer. Perhaps the Wiki could mention minkowski
with more than 2 operators and that the order is not significant (i.e.
commutative).

Ok, I see that if all operators are convex then the minkowski sum is
convex as well, and the calculation becomes much simpler. Good point.

Carsten Arnholm

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org