X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_UnifySameDomain.cpp;h=5bb37ab2106ace1ae52bdaac2bca62c20978f437;hb=HEAD;hp=cfed1f1992a766cb871a625e2ffa467da73ddaed;hpb=77d6e03555d0d46232e09ace4178f66f8c9b40ee;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp index cfed1f199..5bb37ab21 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -31,6 +31,7 @@ #include #include #include +#include //================================================================================================== GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain(const ListOfShape& theShapes) @@ -72,29 +73,18 @@ void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape& theShapes) } // calculates maximum possible tolerance on edges of shape -// (method from GEOM module BlockFix_UnionFaces.cxx) static Standard_Real defineLinearTolerance(const TopoDS_Shape& theShape) { - Standard_Real aTol = Precision::Confusion(); + Standard_Real aMaxTol = Precision::Confusion(); - Standard_Real MinSize = RealLast(); TopExp_Explorer Explo(theShape, TopAbs_EDGE); for (; Explo.More(); Explo.Next()) { const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current()); - Bnd_Box aBox; - BRepBndLib::Add(anEdge, aBox); - Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax; - aBox.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); - Standard_Real MaxSize = Max(Xmax - Xmin, Max(Ymax - Ymin, Zmax - Zmin)); - if (MaxSize < MinSize) - MinSize = MaxSize; + aMaxTol = Max(aMaxTol, BRep_Tool::Tolerance(anEdge)); } - if (!Precision::IsInfinite(MinSize)) - aTol = 0.1 * MinSize; - - return aTol; + return aMaxTol; } //================================================================================================== @@ -105,9 +95,9 @@ void GeomAlgoAPI_UnifySameDomain::build(const GeomShapePtr& theShape, this->setImpl(aUnifyAlgo); const TopoDS_Shape& aShape = theShape->impl(); - aUnifyAlgo->Initialize(aShape); + aUnifyAlgo->Initialize(aShape, Standard_True, Standard_True, Standard_True); aUnifyAlgo->SetLinearTolerance(defineLinearTolerance(aShape)); - aUnifyAlgo->SetAngularTolerance(1.e-6); // for #2697 + aUnifyAlgo->SetAngularTolerance(1.e-5); // for #32443 aUnifyAlgo->Build(); TopoDS_Shape aResult = aUnifyAlgo->Shape();