discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Minkowski with more than child 2 objects

CA
Carsten Arnholm
Sun, Mar 18, 2018 11:41 AM

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

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
NH
nop head
Sun, Mar 18, 2018 1:36 PM

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 arnholm@arnholm.org 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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <arnholm@arnholm.org> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
MK
Marius Kintel
Sun, Mar 18, 2018 1:52 PM

On Mar 18, 2018, at 7:41 AM, Carsten Arnholm arnholm@arnholm.org 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

On Mar 18, 2018, at 7:41 AM, Carsten Arnholm <arnholm@arnholm.org> 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
CA
Carsten Arnholm
Sun, Mar 18, 2018 3:40 PM

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

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