From c27114f079c481989c144f0dbc312b7e7c7c9dc2 Mon Sep 17 00:00:00 2001 From: FtpSantos Date: Mon, 15 Jul 2024 19:15:39 +0100 Subject: [PATCH] 0033727: Modeling Algorithms - Add corner check in AddClose function to detect void bounding box Added corner check to AddClose for void bounding boxes --- src/BRepBndLib/BRepBndLib.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/BRepBndLib/BRepBndLib.cxx b/src/BRepBndLib/BRepBndLib.cxx index db239c4217..22d8cb7dbb 100644 --- a/src/BRepBndLib/BRepBndLib.cxx +++ b/src/BRepBndLib/BRepBndLib.cxx @@ -207,19 +207,26 @@ void BRepBndLib::AddClose(const TopoDS_Shape& S, Bnd_Box& B) BRepAdaptor_Curve BC; - for (ex.Init(S,TopAbs_EDGE); ex.More(); ex.Next()) { + for (ex.Init (S, TopAbs_EDGE); ex.More(); ex.Next()) + { const TopoDS_Edge& anEdge = TopoDS::Edge (ex.Current()); if (BRep_Tool::IsGeometric (anEdge)) { BC.Initialize (anEdge); - BndLib_Add3dCurve::Add(BC,0.,B); + BndLib_Add3dCurve::Add (BC, 0., B); } } // Add the vertices not in edges - for (ex.Init(S,TopAbs_VERTEX,TopAbs_EDGE); ex.More(); ex.Next()) { - B.Add(BRep_Tool::Pnt(TopoDS::Vertex(ex.Current()))); + for (ex.Init (S, TopAbs_VERTEX, TopAbs_EDGE); ex.More(); ex.Next()) + { + B.Add (BRep_Tool::Pnt (TopoDS::Vertex (ex.Current()))); + } + + if (!B.IsVoid() && B.CornerMax().IsEqual (B.CornerMin(), Precision::Confusion() + 2 * B.GetGap())) + { + B.SetVoid(); } }