CavalierContours icon indicating copy to clipboard operation
CavalierContours copied to clipboard

Boolean operations (union operations) do not satisfy the commutative law

Open nathan1-oop opened this issue 6 months ago • 2 comments

I found boolean operations (union operations) do not satisfy the commutative law,

Polyline p1; p1.addVertex(100, 200, -1.0); p1.addVertex(120, 200, , 0.0); p1.addVertex(120, 100, -1.0); p1.addVertex(100, 100, 0.0); p1.isClosed() = true;

Polyline p2; p2.addVertex(110, 190, -1.0); p2.addVertex(110, 210, 0); p2.addVertex(210, 210, -1.0); p2.addVertex(210, 190, 0.0); p2.isClosed() = true;

auto combineResult1 = cavc::combinePolylines(p1, p2, PlineCombineMode::Union); auto combineResult2 = cavc::combinePolylines(p2, p1, PlineCombineMode::Union);

The results are different, one is good and the other is empty.

nathan1-oop avatar Jul 16 '25 04:07 nathan1-oop

I know you have stopped maintaining the c++ version, but do you have any good suggestions, I need it to work normally. Thanks.

nathan1-oop avatar Jul 16 '25 05:07 nathan1-oop

https://github.com/jbuckmccready/CavalierContours/issues/41

https://github.com/jbuckmccready/cavalier_contours

Use the C FFI from C++ (or whatever language you're using if not Rust).

jbuckmccready avatar Jul 19 '25 18:07 jbuckmccready