Feature request January 16, 2017 07:55AM |
Registered: 10 years ago Posts: 782 |
Re: Feature request January 22, 2017 04:21PM |
Registered: 9 years ago Posts: 978 |
// Minkowski difference??? of a given object with second given object, similar to the existing minkowski() function. module minkowskiDifference() { difference() { children(0); minkowski() { children(0); children(1); } } } // Shell of a given object with second given object, similar to the existing minkowski() function. module minkowskiIntersection() { intersection() { minkowskiDifference() { children(0); children(1) } children(0); } }
Re: Feature request January 23, 2017 07:05AM |
Registered: 10 years ago Posts: 782 |
Re: Feature request January 23, 2017 03:59PM |
Registered: 9 years ago Posts: 978 |
module minkowskiDifference() { difference() { minkowski() { children(0); children(1); } children(0); } } intersection() { // To show that the minkowski difference is hollow inside minkowskiDifference() { cube([5, 4, 10]); sphere(1, center=true); } cube([5,4,10], center=true); }
Re: Feature request January 25, 2017 11:19PM |
Registered: 10 years ago Posts: 782 |
Re: Feature request January 26, 2017 08:35AM |
Registered: 10 years ago Posts: 590 |
Quote
frankvdh
I think the following implements Minkowski difference (if I understand correctly what that is). Or are there subtleties I've missed?
Re: Feature request January 26, 2017 09:49AM |
Registered: 10 years ago Posts: 590 |
//////////////////////////////////////////////////////////////////// // Implementation of a Minkowski difference using // the Minkowski sum on a negative ("hole") of the initial object //////////////////////////////////////////////////////////////////// module minkdiff(){ // Subtract from the original object a bigger object with a Minkowski summed (->reduced) hole difference(){ children(0); // Minkowski sum of the negative initial object minkowski(){ // make a hollow object with a hole that corresponds to the initial object difference(){ // increase the size of initial object using Minkowski sum minkowski(){ children(0); cube([1,1,1],true); } // now remove initial object children(0); } children(1); } } } // now try it out, to see if it works... %cylinder(r=10,h=10); %color("red",0.5)translate([-10,0,10])cube([10,1,1],true); minkdiff(){ cylinder(r=10,h=10); cube([10,1,1],true); }