Fix 2d boolean check for periodic curves #6147

This commit is contained in:
Thomas Krijnen
2025-02-12 16:08:32 +01:00
parent ba2456ad36
commit cdcbc2ad3b
@@ -683,10 +683,12 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
BRep_Tool::Curve(e1, u21, u22) BRep_Tool::Curve(e1, u21, u22)
); );
if (!ecc.Extrema().IsParallel() && ecc.NbExtrema() == 1) { if (!ecc.Extrema().IsParallel() && ecc.NbExtrema() >= 1) {
// @todo: extend this to work in case of multiple extrema and curved segments. // @todo: extend this to work in case of multiple extrema and curved segments.
for (int i = 1; i <= ecc.NbExtrema(); ++i) {
gp_Pnt p1, p2; gp_Pnt p1, p2;
ecc.Points(1, p1, p2); ecc.Points(i, p1, p2);
// #3616 Only take into account orthogonal distance between closest points on curve // #3616 Only take into account orthogonal distance between closest points on curve
// to see whether inside tolerance. Current DY is hardcoded. The sensible default // to see whether inside tolerance. Current DY is hardcoded. The sensible default
@@ -699,7 +701,7 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
const bool unbounded_intersects = ortho_distance < eps; const bool unbounded_intersects = ortho_distance < eps;
if (unbounded_intersects) { if (unbounded_intersects) {
ecc.Parameters(1, U1, U2); ecc.Parameters(i, U1, U2);
if (u11 > u12) { if (u11 > u12) {
std::swap(u11, u12); std::swap(u11, u12);
@@ -725,6 +727,7 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
} }
} }
} }
}
// Only inner wires are considered that are directly contained in the outer wire // Only inner wires are considered that are directly contained in the outer wire
// Redundant subtractions are eliminated. // Redundant subtractions are eliminated.