1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +03:00

0024101: Self-Interference Checker provides results that are inconsistent with the Project requirements.

This commit is contained in:
pkv 2013-08-05 11:48:08 +04:00 committed by bugmaster
parent 72e88cf7a8
commit 7ff8f0197e
4 changed files with 183 additions and 14 deletions

View File

@ -26,11 +26,16 @@ class CheckerSI from BOPAlgo
is is
Create Create
returns CheckerSI from BOPAlgo; returns CheckerSI from BOPAlgo;
---C++: alias "Standard_EXPORT virtual ~BOPAlgo_CheckerSI();" ---C++: alias "Standard_EXPORT virtual ~BOPAlgo_CheckerSI();"
Perform(me:out)
is redefined;
Init (me:out) Init (me:out)
is redefined protected; is redefined protected;
SetLevelOfCheck(me:out; SetLevelOfCheck(me:out;
theLevel: Integer from Standard); theLevel: Integer from Standard);
@ -43,6 +48,12 @@ is
-- 4 - V/V, V/E, E/E, V/F and E/F; -- 4 - V/V, V/E, E/E, V/F and E/F;
-- 5 - all interferences, default value. -- 5 - all interferences, default value.
PostTreat (me:out)
is protected;
---Purpose: Provides post-tratment actions
fields fields
myLevelOfCheck: Integer from Standard is protected; myLevelOfCheck: Integer from Standard is protected;

View File

@ -26,11 +26,23 @@
#include <BOPDS_PIteratorSI.hxx> #include <BOPDS_PIteratorSI.hxx>
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_MapOfPassKey.hxx>
#include <BOPDS_PassKey.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_VectorOfInterfEF.hxx>
#include <BOPDS_VectorOfInterfFF.hxx>
#include <BOPDS_VectorOfPoint.hxx>
#include <BOPTools_AlgoTools.hxx>
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
BOPAlgo_CheckerSI::BOPAlgo_CheckerSI() BOPAlgo_CheckerSI::BOPAlgo_CheckerSI()
: :
BOPAlgo_PaveFiller(), BOPAlgo_PaveFiller(),
myLevelOfCheck(5) myLevelOfCheck(5)
@ -40,14 +52,14 @@
//function : ~ //function : ~
//purpose : //purpose :
//======================================================================= //=======================================================================
BOPAlgo_CheckerSI::~BOPAlgo_CheckerSI() BOPAlgo_CheckerSI::~BOPAlgo_CheckerSI()
{ {
} }
//======================================================================= //=======================================================================
//function : SetLevelOfCheck //function : SetLevelOfCheck
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel) void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
{ {
if (theLevel >= 0 && theLevel <= 5) { if (theLevel >= 0 && theLevel <= 5) {
myLevelOfCheck = theLevel; myLevelOfCheck = theLevel;
@ -57,7 +69,7 @@
//function : Init //function : Init
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_CheckerSI::Init() void BOPAlgo_CheckerSI::Init()
{ {
myErrorStatus = 0; myErrorStatus = 0;
// //
@ -86,3 +98,127 @@
// //
myErrorStatus=0; myErrorStatus=0;
} }
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::Perform()
{
BOPAlgo_PaveFiller::Perform();
if (myErrorStatus) {
return;
}
//
PostTreat();
}
//=======================================================================
//function : PostTreat
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PostTreat()
{
Standard_Integer i, aNb, n1, n2;
BOPDS_PassKey aPK;
//
BOPDS_MapOfPassKey& aMPK=*((BOPDS_MapOfPassKey*)&myDS->Interferences());
aMPK.Clear();
//
// 0
BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
aNb=aVVs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVV& aVV=aVVs(i);
aVV.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 1
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
aNb=aVEs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVE& aVE=aVEs(i);
aVE.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 2
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
aNb=aEEs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfEE& aEE=aEEs(i);
aEE.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 3
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aNb=aVFs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVF& aVF=aVFs(i);
aVF.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 4
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
aNb=aEFs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfEF& aEF=aEFs(i);
if (aEF.CommonPart().Type()==TopAbs_SHAPE) {
continue;
}
aEF.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 5
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNb=aFFs.Extent();
for (i=0; i!=aNb; ++i) {
Standard_Boolean bTangentFaces, bFlag;
Standard_Integer aNbC, aNbP, j, iFound;
//
const BOPDS_InterfFF& aFF=aFFs(i);
aFF.Indices(n1, n2);
//
bTangentFaces=aFF.TangentFaces();
aNbP=aFF.Points().Extent();
const BOPDS_VectorOfCurve& aVC=aFF.Curves();
aNbC=aVC.Extent();
if (!aNbP && !aNbC && !bTangentFaces) {
continue;
}
//
iFound=0;
if (bTangentFaces) {
const TopoDS_Face& aF1 = *((TopoDS_Face*)&myDS->Shape(n1));
const TopoDS_Face& aF2 = *((TopoDS_Face*)&myDS->Shape(n2));
bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aF1, aF2, myContext);
if (bFlag) {
++iFound;
}
}
else {
for (j=0; j!=aNbC; ++j) {
const BOPDS_Curve& aNC=aVC(j);
const BOPDS_ListOfPaveBlock& aLPBC=aNC.PaveBlocks();
if (aLPBC.Extent()) {
++iFound;
break;
}
}
}
//
if (!iFound) {
continue;
}
//
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
}

View File

@ -102,7 +102,7 @@ static void ToleranceFF(const TopoDS_Face& aF1,
//function : PerformFF //function : PerformFF
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::PerformFF() void BOPAlgo_PaveFiller::PerformFF()
{ {
Standard_Integer iSize; Standard_Integer iSize;
Standard_Boolean bValid; Standard_Boolean bValid;
@ -116,7 +116,7 @@ static void ToleranceFF(const TopoDS_Face& aF1,
} }
// //
Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone; Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone;
Standard_Boolean bToSplit; Standard_Boolean bToSplit, bTangentFaces;
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, iX, i, iP, iC, aNbLP; Standard_Integer nF1, nF2, aNbCurves, aNbPoints, iX, i, iP, iC, aNbLP;
Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF; Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF;
// //
@ -157,6 +157,7 @@ static void ToleranceFF(const TopoDS_Face& aF1,
if (bIsDone) { if (bIsDone) {
aTolR3D=aFaceFace.TolReached3d(); aTolR3D=aFaceFace.TolReached3d();
aTolR2D=aFaceFace.TolReached2d(); aTolR2D=aFaceFace.TolReached2d();
bTangentFaces=aFaceFace.TangentFaces();
// //
ToleranceFF(aF1, aF2, aTolFF); ToleranceFF(aF1, aF2, aTolFF);
// //
@ -183,6 +184,7 @@ static void ToleranceFF(const TopoDS_Face& aF1,
// //
aFF.SetTolR3D(aTolR3D); aFF.SetTolR3D(aTolR3D);
aFF.SetTolR2D(aTolR2D); aFF.SetTolR2D(aTolR2D);
aFF.SetTangentFaces(bTangentFaces);
// //
// Curves, Points // Curves, Points
aFF.Init(aNbCurves, aNbPoints); aFF.Init(aNbCurves, aNbPoints);
@ -333,7 +335,7 @@ static void ToleranceFF(const TopoDS_Face& aF1,
PutPaveOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMVEF); PutPaveOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMVEF);
// //
PutStickPavesOnCurve(nF1, nF2, aNC, aMVStick); PutStickPavesOnCurve(nF1, nF2, aNC, aMVStick);
//pkv/904/F7 //904/F7
if (aNbC == 1) { if (aNbC == 1) {
PutEFPavesOnCurve(nF1, nF2, aNC, aMVEF); PutEFPavesOnCurve(nF1, nF2, aNC, aMVEF);
} }

View File

@ -511,6 +511,7 @@ class BOPDS_InterfFF : public BOPDS_Interf {
BOPDS_InterfFF() BOPDS_InterfFF()
: :
BOPDS_Interf(), BOPDS_Interf(),
myTangentFaces(Standard_False),
myTolR3D(1.e-7), myTolR3D(1.e-7),
myTolR2D(1.e-7), myTolR2D(1.e-7),
myCurves(myAllocator), myCurves(myAllocator),
@ -526,6 +527,7 @@ class BOPDS_InterfFF : public BOPDS_Interf {
BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator) BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator)
: :
BOPDS_Interf(theAllocator), BOPDS_Interf(theAllocator),
myTangentFaces(Standard_False),
myTolR3D(1.e-7), myTolR3D(1.e-7),
myTolR2D(1.e-7), myTolR2D(1.e-7),
myCurves(myAllocator), myCurves(myAllocator),
@ -558,7 +560,24 @@ class BOPDS_InterfFF : public BOPDS_Interf {
myPoints.Init(); myPoints.Init();
} }
} }
// /**
* Modifier
* Sets the flag of whether the faces are tangent
* @param theFlag
* the flag
*/
void SetTangentFaces(const Standard_Boolean theFlag) {
myTangentFaces=theFlag;
}
/**
* Selector
* Returns the flag whether the faces are tangent
* @return
* the flag
*/
Standard_Boolean TangentFaces()const {
return myTangentFaces;
}
/** /**
* Modifier * Modifier
* Sets the value of 3D tolerance * Sets the value of 3D tolerance
@ -640,6 +659,7 @@ class BOPDS_InterfFF : public BOPDS_Interf {
}; };
// //
protected: protected:
Standard_Boolean myTangentFaces;
Standard_Real myTolR3D; Standard_Real myTolR3D;
Standard_Real myTolR2D; Standard_Real myTolR2D;
BOPDS_VectorOfCurve myCurves; BOPDS_VectorOfCurve myCurves;