BRepMesh_CurveTessellator::BRepMesh_CurveTessellator(
const IMeshData::IEdgeHandle& theEdge,
const IMeshTools_Parameters& theParameters,
- const Standard_Integer theMinPointsNb)
+ const Standard_Integer theMinPointsNb,
+ const Standard_Boolean isUseVertexTolerance)
: myDEdge(theEdge),
myParameters(theParameters),
+ myUseVertexTolerance(isUseVertexTolerance),
myEdge(theEdge->GetEdge()),
myCurve(myEdge),
myMinPointsNb (theMinPointsNb)
const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters,
- const Standard_Integer theMinPointsNb)
+ const Standard_Integer theMinPointsNb,
+ const Standard_Boolean isUseVertexTolerance)
: myDEdge(theEdge),
myParameters(theParameters),
+ myUseVertexTolerance(isUseVertexTolerance),
myEdge(TopoDS::Edge(theEdge->GetEdge().Oriented(theOrientation))),
myCurve(myEdge, theFace->GetFace()),
myMinPointsNb (theMinPointsNb)
const gp_Pnt& thePoint,
const TopoDS_Vertex& theVertex) const
{
- const gp_Pnt aPoint = BRep_Tool::Pnt(theVertex);
- const Standard_Real aTolerance = BRep_Tool::Tolerance(theVertex) * 1.1;
+ if (myUseVertexTolerance)
+ {
+ const gp_Pnt aPoint = BRep_Tool::Pnt(theVertex);
+ const Standard_Real aTolerance = BRep_Tool::Tolerance(theVertex) * 1.1;
+
+ return (thePoint.SquareDistance (aPoint) < aTolerance * aTolerance);
+ }
- return (thePoint.SquareDistance (aPoint) < aTolerance * aTolerance);
+ return Standard_False;
}
//=======================================================================
Standard_EXPORT BRepMesh_CurveTessellator(
const IMeshData::IEdgeHandle& theEdge,
const IMeshTools_Parameters& theParameters,
- const Standard_Integer theMinPointsNb = 2);
+ const Standard_Integer theMinPointsNb = 2,
+ const Standard_Boolean isUseVertexTolerance = Standard_False);
//! Constructor.
Standard_EXPORT BRepMesh_CurveTessellator (
const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters,
- const Standard_Integer theMinPointsNb = 2);
+ const Standard_Integer theMinPointsNb = 2,
+ const Standard_Boolean isUseVertexTolerance = Standard_False);
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_CurveTessellator ();
const IMeshData::IEdgeHandle& myDEdge;
const IMeshTools_Parameters& myParameters;
+ Standard_Boolean myUseVertexTolerance;
TopoDS_Edge myEdge;
BRepAdaptor_Curve myCurve;
Standard_Integer myMinPointsNb;
const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theDFace,
const IMeshTools_Parameters& theParameters,
- const Standard_Integer theMinPointsNb)
+ const Standard_Integer theMinPointsNb,
+ const Standard_Boolean isUseVertexTolerance)
{
return theDEdge->GetSameParam() ?
- new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb) :
- new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters, theMinPointsNb);
+ new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb, isUseVertexTolerance) :
+ new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters, theMinPointsNb, isUseVertexTolerance);
}
//=======================================================================
const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theDFace,
const IMeshTools_Parameters& theParameters,
- const Standard_Integer theMinPointsNb = 2);
+ const Standard_Integer theMinPointsNb = 2,
+ const Standard_Boolean isUseVertexTolerance = Standard_False);
//! Creates instance of tessellation extractor.
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellationExtractor(
Handle(IMeshData::MapOfIEdgePtr)& aIntersections = myWiresIntersectingEdges->ChangeValue(theWireIndex);
// TODO: Tolerance is set to twice value of face deflection in order to fit regressions.
- BndBox2dTreeSelector aSelector(2 * myDFace->GetDeflection());
+ BndBox2dTreeSelector aSelector(2 * Precision::PConfusion()/*myDFace->GetDeflection()*/);
for (Standard_Integer aWireIt = theWireIndex; aWireIt < myDFace->WiresNb(); ++aWireIt)
{
const Handle(IMeshData::BndBox2dTree)& aBndBoxTree2 = myWiresBndBoxTree->Value(aWireIt);
{
public:
//! Constructor.
- EdgeAmplifier(const IMeshTools_Parameters& theParameters)
- : myParameters(theParameters)
+ EdgeAmplifier(const IMeshTools_Parameters& theParameters,
+ const Standard_Boolean isUseVertexTolerance = Standard_False)
+ : myParameters (theParameters),
+ myUseVertexTolerance(isUseVertexTolerance)
{
}
+ //! Take vertex tolerance into account.
+ void SetUseVertexTolerance(const Standard_Boolean isUseVertexTolerance)
+ {
+ myUseVertexTolerance = isUseVertexTolerance;
+ }
+
//! Main operator.
void operator()(const IMeshData::IEdgePtr& theDEdge) const
{
Handle(IMeshTools_CurveTessellator) aTessellator =
BRepMesh_EdgeDiscret::CreateEdgeTessellator(
aDEdge, aPCurve->GetOrientation(), aDFace,
- myParameters, aPointsNb);
+ myParameters, aPointsNb, myUseVertexTolerance);
BRepMesh_EdgeDiscret::Tessellate3d(aDEdge, aTessellator, Standard_False);
BRepMesh_EdgeDiscret::Tessellate2d(aDEdge, Standard_False);
private:
const IMeshTools_Parameters& myParameters;
+ Standard_Boolean myUseVertexTolerance;
};
//! Returns True if some of two vertcies is same with reference one.
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
Standard_Integer aAmpIt = 0;
- const Standard_Real aIterNb = 5;
+ const Standard_Integer aIterNb = 6;
IMeshData::MapOfIEdgePtr aEdgesToUpdate(1, aTmpAlloc);
EdgeAmplifier anEdgeAmplifier (myParameters);
while (aAmpIt++ < aIterNb && popEdgesToUpdate(aEdgesToUpdate))
{
+ anEdgeAmplifier.SetUseVertexTolerance (aAmpIt == aIterNb);
+
// Try to update discretization by decreasing deflection of problematic edges.
OSD_Parallel::ForEach(aEdgesToUpdate.cbegin(), aEdgesToUpdate.cend(),
anEdgeAmplifier,