#3616 Only consider distance orthogonal to projection vector for 2d boolean preprocessing

This commit is contained in:
Thomas Krijnen
2023-08-22 15:00:25 +02:00
parent ca7984e12e
commit d233f3e488
@@ -683,8 +683,21 @@ 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) {
// @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.
const bool unbounded_intersects = (!ecc.Extrema().IsParallel() && ecc.NbExtrema() == 1 && ecc.Distance(1) < eps); gp_Pnt p1, p2;
ecc.Points(1, p1, p2);
// #3616 Only take into account orthogonal distance between closest points on curve
// to see whether inside tolerance. Current DY is hardcoded. The sensible default
// for walls.
gp_Vec vec(p1, p2);
Standard_Real d = vec.Dot(gp::DY());
gp_Vec projected = d * gp::DY();
gp_Vec ortho_remainder = vec - projected;
Standard_Real ortho_distance = ortho_remainder.Magnitude();
const bool unbounded_intersects = ortho_distance < eps;
if (unbounded_intersects) { if (unbounded_intersects) {
ecc.Parameters(1, U1, U2); ecc.Parameters(1, U1, U2);
@@ -711,6 +724,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.