discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Minkowski puzzle

T
Terry
Fri, Feb 11, 2022 4:47 PM

I'm confident someone will explain why the following intuitive assumption is
invalid!

If I export a fairly complex design as an STL, then import that and apply
minkowski,

// Import test, to apply minkowski()

minkowski()
{
import("C:/Users/terry/Dropbox/3D Printer/PROJECTS/Customisable
Knobs/VintageKnobC-16-13-NoBevels.stl");

sphere(0.3);
}

then it previews and renders as expected.

Why therefore is that not the case if instead I simply place those statements at
the start and end of the original code?

I'll post the 159 lines of code if required.

I'm confident someone will explain why the following intuitive assumption is invalid! If I export a fairly complex design as an STL, then import that and apply minkowski, -------------------- // Import test, to apply minkowski() minkowski() { import("C:/Users/terry/Dropbox/3D Printer/PROJECTS/Customisable Knobs/VintageKnobC-16-13-NoBevels.stl"); sphere(0.3); } -------------------- then it previews and renders as expected. Why therefore is that not the case if instead I simply place those statements at the start and end of the original code? I'll post the 159 lines of code if required.
JB
Jordan Brown
Fri, Feb 11, 2022 5:43 PM

On 2/11/2022 8:47 AM, Terry wrote:

Why therefore is that not the case if instead I simply place those statements at the start and end of the original code?

I'm not a minkowski expert, but it normally takes two arguments and adds
one to the other.  It looks like if you give it more than two, it adds
one to the next, to the next.

If your original file was

translate([2,0,0]) cube(1);
translate([4,0,0]) cube(1);

then just slapping some minkowski around it:

minkowski() {
    translate([2,0,0]) cube(1);
    translate([4,0,0]) cube(1);
    sphere(1);
}

will not do what you want.  The original was (implicitly) a union of two
cubes, while what you have now is the minkowski sum of two cubes and a
sphere. (Note:  I don't know what a minkowski sum means when the second
object doesn't touch the origin, but it doesn't mean "union".)

You would need to add some grouping, probably a union, so that you are
giving minkowski() two arguments, e.g.:

minkowski() {
    union() {
        translate([2,0,0]) cube(1);
        translate([4,0,0]) cube(1);
    }
    sphere(1);
}

I'll post the 159 lines of code if required.

I suspect that you could cut that down considerably and still
demonstrate the question, but if what I've said above doesn't answer it
and you don't see how to cut it down, go ahead and send the full example.

On 2/11/2022 8:47 AM, Terry wrote: > Why therefore is that not the case if instead I simply place those statements at the start and end of the original code? I'm not a minkowski expert, but it normally takes two arguments and adds one to the other.  It looks like if you give it more than two, it adds one to the next, to the next. If your original file was translate([2,0,0]) cube(1); translate([4,0,0]) cube(1); then just slapping some minkowski around it: minkowski() { translate([2,0,0]) cube(1); translate([4,0,0]) cube(1); sphere(1); } will not do what you want.  The original was (implicitly) a union of two cubes, while what you have now is the minkowski sum of two cubes and a sphere. (Note:  I don't know what a minkowski sum means when the second object doesn't touch the origin, but it doesn't mean "union".) You would need to add some grouping, probably a union, so that you are giving minkowski() two arguments, e.g.: minkowski() { union() { translate([2,0,0]) cube(1); translate([4,0,0]) cube(1); } sphere(1); } > I'll post the 159 lines of code if required. I suspect that you could cut that down considerably and still demonstrate the question, but if what I've said above doesn't answer it and you don't see how to cut it down, go ahead and send the full example.