Apparent minkowski() bug in 2019.03.03 dev OpenSCAD

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

Apparent minkowski() bug in 2019.03.03 dev OpenSCAD

RevarBat
I just ran into a really bizarre bug, apparently in minkowski().  The following code renders incorrectly on my system, in both preview and rendering:

$fn = 7;
minkowski() {
    cube(0.1);
    union() {
        translate([5, 0, 0]) cylinder(h=10, r=5, center=true);
        cylinder(h=5, r=10, center=true);
    }
}

It should output a slightly warped wide cylinder with a longer, thin cylinder poking through it along one side.
Instead it shows what looks like the longer, thin cylinder, with the wider cylinder differenced from it.  It acts like that union() is a difference().

It'll render correctly if you remove the translate().  If you translate by a value other than 5, then it works.  It works if you set $fn to any of 5, 6, 8, 9, or 12, but it fails when $fn is 7, 10, or 11. Very odd!

Here's an image of the failed render, and an image of a successful render with $fn=8:


- Revar



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

Re: Apparent minkowski() bug in 2019.03.03 dev OpenSCAD

nophead
Yes very bizarre end result, but I think it is due to doing a union of very nearly coincident faces. Changing the translate to 5 - 1/1024 fixes it.



On Mon, 4 Mar 2019 at 12:14, Revar Desmera <[hidden email]> wrote:
I just ran into a really bizarre bug, apparently in minkowski().  The following code renders incorrectly on my system, in both preview and rendering:

$fn = 7;
minkowski() {
    cube(0.1);
    union() {
        translate([5, 0, 0]) cylinder(h=10, r=5, center=true);
        cylinder(h=5, r=10, center=true);
    }
}

It should output a slightly warped wide cylinder with a longer, thin cylinder poking through it along one side.
Instead it shows what looks like the longer, thin cylinder, with the wider cylinder differenced from it.  It acts like that union() is a difference().

It'll render correctly if you remove the translate().  If you translate by a value other than 5, then it works.  It works if you set $fn to any of 5, 6, 8, 9, or 12, but it fails when $fn is 7, 10, or 11. Very odd!

Here's an image of the failed render, and an image of a successful render with $fn=8:


- Revar


_______________________________________________
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