Difference doesn't work, either.

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

Difference doesn't work, either.

Henry Baker
(This may be the same bug as the intersection bug.)

This code works correctly:

difference() {
cube(size = [10, 10, 10], center = true);

multmatrix([[1, 0, 0, 0], [0, 0, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]])
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]])
cube(size = [100, 100, 100], center = true);
}

But this code doesn't work:

difference() {
cube(size = [10, 10, 10], center = true);

multmatrix([[-1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]])
cube(size = [100, 100, 100], center = true);
}

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Difference doesn't work, either.

kintel
Administrator
On 2013-06-27, at 12:17 , Henry Baker wrote:

> (This may be the same bug as the intersection bug.)
>
> But this code doesn't work:
>
[…]
> multmatrix([[-1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])

I think this is the culprit. When inverting something, CGAL implicitly also inverts what is inside and what is outside, and eventually something gets confused. It looks like an off number of inversions cause this to happen.
The same symptoms can be seen when using mirror().

Ideas on how to fix this are welcome :)

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Difference doesn't work, either.

Henry Baker
Thanks, Marius!

In this particular case, I should have been rotating instead of mirroring, anyway, so my bug shed some light on an OpenSCAD bug!

With my bug fixed, there's no need to rush to fix this OpenSCAD bug on my behalf.

At 09:38 AM 6/27/2013, Marius Kintel wrote:

>On 2013-06-27, at 12:17 , Henry Baker wrote:
>
>> (This may be the same bug as the intersection bug.)
>>
>> But this code doesn't work:
>>
>[…]
>> multmatrix([[-1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
>
>I think this is the culprit. When inverting something, CGAL implicitly also inverts what is inside and what is outside, and eventually something gets confused. It looks like an off number of inversions cause this to happen.
>The same symptoms can be seen when using mirror().
>
>Ideas on how to fix this are welcome :)
>
> -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Difference doesn't work, either.

kintel
Administrator
On 2013-06-27, at 13:55 , Henry Baker wrote:

> In this particular case, I should have been rotating instead of mirroring, anyway, so my bug shed some light on an OpenSCAD bug!
>
> With my bug fixed, there's no need to rush to fix this OpenSCAD bug on my behalf.
>
Good :)
Feel free to add your observations to this issue: https://github.com/openscad/openscad/issues/393

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566