0021835: EDF 2070 GEOM : Problem with detecting Self-intersections

This commit is contained in:
skv 2013-06-17 07:20:09 +00:00
parent 8fe997ae88
commit 6ddc7178e6
7 changed files with 58 additions and 10 deletions

View File

@ -27,6 +27,7 @@
#include <Standard_Version.hxx>
#include <NMTTools_PaveFiller.hxx>
#include <NMTTools_Tools.hxx>
#include <Basics_OCCTVersion.hxx>
@ -117,7 +118,7 @@ void NMTTools_PaveFiller::PerformVE()
}
// Edge
aE2=TopoDS::Edge(myDS->Shape(aWith));
if (BRep_Tool::Degenerated(aE2)){
if (NMTTools_Tools::IsDegenerated(aE2)){
continue;
}
// Vertex
@ -221,7 +222,7 @@ void NMTTools_PaveFiller::PrepareEdges()
if (myDS->GetShapeType(i)==TopAbs_EDGE) {
aE=TopoDS::Edge(myDS->Shape(i));
//
if (BRep_Tool::Degenerated(aE)){
if (NMTTools_Tools::IsDegenerated(aE)){
continue;
}
//

View File

@ -24,6 +24,7 @@
// Author: Peter KURNEV
#include <NMTTools_PaveFiller.hxx>
#include <NMTTools_Tools.hxx>
#include <stdio.h>
#include <Precision.hxx>
@ -184,7 +185,8 @@ void NMTTools_PaveFiller::PerformEE()
const TopoDS_Edge aE1=TopoDS::Edge(myDS->Shape(nE1));//mpv
const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv
//
if (BRep_Tool::Degenerated(aE1) || BRep_Tool::Degenerated(aE2)){
if (NMTTools_Tools::IsDegenerated(aE1) ||
NMTTools_Tools::IsDegenerated(aE2)){
continue;
}
//
@ -955,7 +957,7 @@ void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE)
BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
// Edge
aE=TopoDS::Edge(myDS->Shape(nE));
if (BRep_Tool::Degenerated(aE)) {
if (NMTTools_Tools::IsDegenerated(aE)) {
myIsDone=Standard_True;
return;
}

View File

@ -74,6 +74,7 @@
#include <BOPTools_ESInterference.hxx>
#include <BOPTools_IDMapOfPaveBlockIMapOfInteger.hxx>
#include <BOPTools_IMapOfPaveBlock.hxx>
#include <BRepTools.hxx>
#include <NMTDS_ShapesDataStructure.hxx>
#include <NMTDS_Iterator.hxx>
@ -84,6 +85,7 @@
#include <NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx>
#include <NMTTools_CommonBlockAPI.hxx>
#include <NMTTools_ListOfCommonBlock.hxx>
#include <NMTTools_Tools.hxx>
static
@ -146,7 +148,7 @@ static
//
// Edge
const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));
if (BRep_Tool::Degenerated(aE)){
if (NMTTools_Tools::IsDegenerated(aE)){
continue;
}
//
@ -199,6 +201,8 @@ static
BOPTools_Tools::CorrectRange(aE, aF, aSR, anewSR);
aEF.SetRange (anewSR);
//
BRepTools::Write(aE, "/dn20/salome/skv/SALOME/scripts/Dumps/edge");
BRepTools::Write(aF, "/dn20/salome/skv/SALOME/scripts/Dumps/face");
aEF.Perform();
//
if (aEF.IsDone()) {

View File

@ -782,7 +782,7 @@ void NMTTools_PaveFiller::MakePCurves()
}
const TopoDS_Edge& aE=TopoDS::Edge(aS);
//
if (BRep_Tool::Degenerated(aE)) {
if (NMTTools_Tools::IsDegenerated(aE)) {
continue;
}
//

View File

@ -24,6 +24,7 @@
// Author: Peter KURNEV
#include <NMTTools_PaveFiller.hxx>
#include <NMTTools_Tools.hxx>
#include <Bnd_HArray1OfBox.hxx>
#include <Bnd_BoundSortBox.hxx>
@ -108,7 +109,7 @@ void NMTTools_PaveFiller::MakeSplitEdges()
//
// Original Edge
aE=TopoDS::Edge(myDS->Shape(i));
if (BRep_Tool::Degenerated(aE)){
if (NMTTools_Tools::IsDegenerated(aE)){
continue;
}
//
@ -198,7 +199,7 @@ void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
}
//
const TopoDS_Edge& aE=*((TopoDS_Edge*)&myDS->Shape(nE));
if (BRep_Tool::Degenerated(aE)){
if (NMTTools_Tools::IsDegenerated(aE)){
continue;
}
//
@ -371,7 +372,7 @@ void NMTTools_PaveFiller::UpdateCommonBlocks()
if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
continue;
}
if (BRep_Tool::Degenerated(TopoDS::Edge(myDS->Shape(nE)))){
if (NMTTools_Tools::IsDegenerated(TopoDS::Edge(myDS->Shape(nE)))){
continue;
}
//
@ -489,7 +490,7 @@ void NMTTools_PaveFiller::UpdatePaveBlocks()
for(; aExp.More(); aExp.Next()) {
aE=TopoDS::Edge(aExp.Current());
//
if (BRep_Tool::Degenerated(aE)) {
if (NMTTools_Tools::IsDegenerated(aE)) {
continue;
}
//

View File

@ -73,6 +73,7 @@
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <Precision.hxx>
static
void ProcessBlock(const Standard_Integer iV,
@ -612,3 +613,39 @@ void ProcessBlock(const TopoDS_Shape& aF,
ProcessBlock(aFx, aMCV, aProcessed, aChain);
}
}
//=======================================================================
// function: IsDegenerated
// purpose :
//=======================================================================
Standard_Boolean NMTTools_Tools::IsDegenerated(const TopoDS_Edge &theEdge)
{
Standard_Boolean aResult = BRep_Tool::Degenerated(theEdge);
if (!aResult) {
// Check if there is a null-length 3d curve.
Standard_Real aF;
Standard_Real aL;
Handle(Geom_Curve) aCrv = BRep_Tool::Curve(theEdge, aF, aL);
aResult = aCrv.IsNull();
if (!aResult) {
const Standard_Real aTolConf2 =
Precision::Confusion()*Precision::Confusion();
gp_Pnt aPnt[2] = { aCrv->Value(aF), aCrv->Value(aL) };
if (aPnt[0].SquareDistance(aPnt[1]) <= aTolConf2) {
// Check the middle point.
const gp_Pnt aPMid = aCrv->Value(0.5*(aF + aL));
if (aPnt[0].SquareDistance(aPMid) <= aTolConf2) {
// 3D curve is degenerated.
aResult = Standard_True;
}
}
}
}
return aResult;
}

View File

@ -95,5 +95,8 @@ class NMTTools_Tools {
static void UpdateEdge(const TopoDS_Edge& aE,
const Standard_Real aTol) ;
Standard_EXPORT
static Standard_Boolean IsDegenerated(const TopoDS_Edge &theEdge);
};
#endif