#include <GeomAlgoAPI_DFLoader.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <BRep_Tool.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
#include <Precision.hxx>
}
// 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;
}
//==================================================================================================