# Does Minkowski work only in 2d?

25 messages
12
Open this post in threaded view
|

## Does Minkowski work only in 2d?

 I am having a look at Minkowski and observe that the documentation isn't all that clear on this question. The manual mentions this example \$fn=50; minkowski() {   cube([10,10,1]);   cylinder(r=2,h=1); } Which appears to demonstrate Minkowski working on 3d objects. However, if you try \$fn=50; minkowski() {   translate([0,0,10])cube([10,10,1]);   cylinder(r=2,h=1); } ... all you get is the same result translated upwards. The exact same thing happens if you translate the cylinder instead of the cube, which means this isn't really working in 3d. If you try \$fn=50; minkowski() {   translate([0,0,-10]) cube([10,10,1]);   translate([0,0,10]) cylinder(r=2,h=1); } You are back to the original result. The two translations cancel each other out! But then, if you try \$fn=50; minkowski() {   translate([0,0,-10]) cube([10,10,1]);   translate([0,0,10]) cylinder(r=2,h=1); } you get something that looks more like an odd 3d hull operation. Finally, some creative stuff to possibly igure out what is happening: \$fn=50; minkowski() {   cube([10,10,0.000000001]);   rotate([90,0,0])   difference() {     cylinder(r=2,h=1);     translate([1,0,0])cylinder(r=1.5,h=3,center=true);   } } It looks like the second object is now swept along the edge of the first object, and the area between is almost like a hull. However, if you switch the order, the result is the same... Is there a more detailed description somewhere on how this really works? Are these examples well defined? Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 Sorry, there was a typo On 07. mars 2016 22:11, Carsten Arnholm wrote: > But then, if you try > > \$fn=50; > minkowski() > { >   translate([0,0,-10]) cube([10,10,1]); >   translate([0,0,10]) cylinder(r=2,h=1); > } > > you get something that looks more like an odd 3d hull operation. > It was supposed to be \$fn=50; minkowski() {   rotate([30,0,0]) cube([10,10,1]);   translate([0,0,10]) cylinder(r=2,h=1); } Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 You can regard minkowski as an inner product. Which "natural" 3D semantics would you expect when translations are inserted? but try this: \$fn=50; minkowski() {    rotate([45, 45, 0])   cube([10,10,1]);   cylinder(r=2,h=1); } or this: \$fn=50; minkowski() {    rotate([45, 45, 0])   cube([10,10,1]);   scale([2, 1, 1])  cylinder(r=2,h=1); }
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 It looks like the second object is now swept along the edge of the first object, and the area between is almost like a hull. However, if you switch the order, the result is the same... A Minkowski sum is commutative so yes if you swap the order you get the same result. Is there a more detailed description somewhere on how this really works? Are these examples well defined?Yes it is well defined mathematically, see https://en.wikipedia.org/wiki/Minkowski_addition.Basically if you think of the origin of one object swept along all the edges of the other object and unioned together that is the result. All your examples do what I expect. On 7 March 2016 at 23:16, Parkinbot wrote:You can regard minkowski as an inner product. Which "natural" 3D semantics would you expect when translations are inserted? but try this: \$fn=50; minkowski() {    rotate([45, 45, 0])   cube([10,10,1]);   cylinder(r=2,h=1); } or this: \$fn=50; minkowski() {    rotate([45, 45, 0])   cube([10,10,1]);   scale([2, 1, 1])  cylinder(r=2,h=1); } -- View this message in context: http://forum.openscad.org/Does-Minkowski-work-only-in-2d-tp16334p16338.html Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ 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
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 In reply to this post by Parkinbot On 2016-03-08 00:16, Parkinbot wrote: > You can regard minkowski as an inner product. Which "natural" 3D > semantics > would you expect when translations are inserted? What do you mean by inner product in this context? I don't have a lot of expectations, but rather trying to understand the definition so I can establish expectations of how this is supposed to work. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 The definition in simple terms is that the origin of the first object is placed at every point inside the second object and the results unioned. Of course that would be an infinite number unless the object was divided into voxels.In practice you get exactly the same result sweeping the origin of the first object along all the edges of the second object. Again infinite but less so ;-)If the object is convex than you can place the origin of the first object at all of the vertices of the second object and take the convex hull. This is now finite to compute as it is just a hull of all the vertices of one object added to all the vertices of the other object. This is why you said some of the results look like a hull. They are. And since vector addition is commutative, so is Minkowski.  To do Minkowski on concave objects you need to decompose them into multiple convex ones, do convex Minkowski on those and then union the results.On 8 March 2016 at 06:15, wrote:On 2016-03-08 00:16, Parkinbot wrote: You can regard minkowski as an inner product. Which "natural" 3D semantics would you expect when translations are inserted? What do you mean by inner product in this context? I don't have a lot of expectations, but rather trying to understand the definition so I can establish expectations of how this is supposed to work. _______________________________________________ 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
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 Von: "nop head" <[hidden email]> > If the object is convex than you can place the origin of > the first object at all of the vertices of the second object > and take the convex hull. This is now finite to compute as > it is just a hull of all the vertices of one object added > to all the vertices of the other object. This is why you > said some of the results look like a hull. They are. And > since vector addition is commutative, so is Minkowski.  > Yep, that's exactly how it's implemented now. IIRC that was the optimization Oskar did some time ago. It uses CGAL to do a convex decomposition and then creates the convex minkowski meshes and unions those together again. This is the reason why minkowski now can be very fast if the convex decomposition produces only a small number of parts while object like a cube with a sphere cut out are quite slow as there's a huge performance hit with the final union operation. ciao,   Torsten. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Torsten
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 On 08. mars 2016 14:58, doug moen wrote: > I've been confused about this for a while. The discussion is kind of interesting, but my overall impression is that minkowski is rarely useful in practice as it can be difficult for an end user to predict/understand what it does and where the result will end up in relation to other parts. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 Minkowski with a centred sphere is a useful operation that inflates an object like a balloon, producing rounded corners. If the sphere has radius r, then the new inflated object boundary will be exactly r units away from the original boundary at all points.That's the only practical application of minkowski that I know, but it's a pretty good application, and not difficult to understand on its own.On 8 March 2016 at 17:48, Carsten Arnholm wrote:On 08. mars 2016 14:58, doug moen wrote: I've been confused about this for a while. The discussion is kind of interesting, but my overall impression is that minkowski is rarely useful in practice as it can be difficult for an end user to predict/understand what it does and where the result will end up in relation to other parts. 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
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

 In reply to this post by cacb I find minkowski generally useful but leads to lazy thinking. Its convenient to use a cylider 0.1 high and minkowski - when in fact I should be using offset etc. So I think a lot of people use it instead of doing it a simpler way which requires more thinking about what they want to achieve. The length of time it takes to process is the balancing factor, as this forces you to reconsider your choices when its taking ages to build :) I may be incorrect but I think having the minkowski is one of the only reasons (and hull) we still use nef_polyhedron and the CGAL. I mean the difficulty in coding a replacement in a faster library... However - its hard to give up the minkowski... its seductive.... and the hull is fantastically useful of course.
Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

Open this post in threaded view
|

## Re: Does Minkowski work only in 2d?

Open this post in threaded view
|