1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0021762: Integration of new Boolean Operation algorithm to OCCT.

Modifications:
1. Test cases boolean bfuse_complex J1 P9 have been fixed (the function IsInternalFace has been modified to use the function GetFaceOff);
2. Test case chl 902 H3 has been fixed (changes in the treatment of section edges);
3. Test case boolean bsection D8 has been modified (removed TODO statement);
4. Test case boolean bsection A3 has been modified (as the shapes have been changed).
This commit is contained in:
emv 2012-11-30 12:55:58 +04:00
parent eb000a3bd7
commit ba5361f35a
8 changed files with 142 additions and 235 deletions

View File

@ -357,7 +357,7 @@ static
aSelF=(*(TopoDS_Face*)(&aLCSOff.First().Shape2()));
}
else if (aNbOff>1){
BOPTools_AlgoTools::GetFaceOff(aE, aF, aLCSOff, aSelF);
BOPTools_AlgoTools::GetFaceOff(aE, aF, aLCSOff, aSelF, myContext);
}
//
if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) {

View File

@ -223,7 +223,8 @@ is
PostTreatFF(me:out;
theMSCPB:out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS;
theMVI:out DataMapOfShapeInteger from BOPCol;
theMVI:out DataMapOfShapeInteger from BOPCol;
theDMExEd:out DataMapOfPaveBlockListOfPaveBlock from BOPDS;
theAllocator:out BaseAllocator from BOPCol)
returns Integer from Standard
is protected;
@ -313,7 +314,8 @@ is
--modified by NIZHNY-EMV Fri Dec 23 15:40:06 2011
--modified by NIZHNY-EMV Tue Dec 13 10:21:47 2011
UpdateExistingPaveBlocks(me:out;
UpdateExistingPaveBlocks(me:out;
thePB : PaveBlock from BOPDS;
theLPB : out ListOfPaveBlock from BOPDS;
nF1 : Integer from Standard;
nF2 : Integer from Standard)

View File

@ -92,16 +92,14 @@
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopExp.hxx>
#include <BOPInt_ShrunkRange.hxx>
static void FindPaveBlocksByFirst(BOPDS_ListOfPaveBlock& aLPBC,
BOPDS_ListOfPaveBlock& aLPB);
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
const Handle(BOPInt_Context)& aCtx);
static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
const TopoDS_Face& aF2);
static void ToleranceFF(const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
Standard_Real& aTolFF);
//=======================================================================
//function : PerformFF
@ -123,7 +121,7 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone;
Standard_Boolean bToSplit;
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, iX, i, iP, iC, aNbLP;
Standard_Real aApproxTol, aTolR3D, aTolR2D;
Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aFFs.SetStartSize(iSize);
@ -164,12 +162,11 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
if (bIsDone) {
aTolR3D=aFaceFace.TolReached3d();
aTolR2D=aFaceFace.TolReached2d();
if (aTolR3D < 5.e-6){
if (!IsAnalytic(aF1, aF2)) {
aTolR3D=5.e-6;
} else if (aTolR3D < 1.e-7) {
aTolR3D=1.e-7;
}
//
ToleranceFF(aF1, aF2, aTolFF);
//
if (aTolR3D < aTolFF){
aTolR3D=aTolFF;
}
if (aTolR2D < 1.e-7){
aTolR2D=1.e-7;
@ -271,6 +268,7 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
BOPDS_ListOfPaveBlock aLPB(aAllocator);
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMSCPB(100, aAllocator);
BOPCol_DataMapOfShapeInteger aMVI(100, aAllocator);
BOPDS_DataMapOfPaveBlockListOfPaveBlock aDMExEdges;
//modified by NIZHNY-EMV Tue Sep 27 08:26:45 2011
BOPCol_DataMapOfIntegerListOfInteger aMInterfs;
BOPCol_ListOfInteger aLIEF;
@ -447,7 +445,7 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
}//for (i=0; i<aNbFF; ++i) {
//
// post treatment
myErrorStatus=PostTreatFF(aMSCPB, aMVI, aAllocator);
myErrorStatus=PostTreatFF(aMSCPB, aMVI, aDMExEdges, aAllocator);
if (myErrorStatus) {
return;
}
@ -465,8 +463,16 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
for (j=0; j<aNbC; ++j) {
BOPDS_Curve& aNC=aVNC(j);
BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
UpdateExistingPaveBlocks(aLPBC, nF1, nF2);
aItLPB.Initialize(aLPBC);
//
if (aItLPB.More() && aDMExEdges.IsBound(aLPBC.First())) {
const Handle(BOPDS_PaveBlock)& aPB=aLPBC.First();
BOPDS_ListOfPaveBlock& aLPB = aDMExEdges.ChangeFind(aPB);
UpdateExistingPaveBlocks(aPB, aLPB, nF1, nF2);
aLPBC.Clear();
continue;
}
//
for(; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value();
aFI1.ChangePaveBlocksSc().Add(aPB);
@ -488,6 +494,7 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
aMVStick.Clear();
aMPBOnIn.Clear();
aMVOnIn.Clear();
aDMExEdges.Clear();
aAllocator.Nullify();
}
@ -498,6 +505,7 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPCol_DataMapOfShapeInteger& aMVI,
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
Handle(NCollection_BaseAllocator)& theAllocator)
{
Standard_Integer iRet, aNbS;
@ -553,11 +561,9 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
aPB1=aCPB.PaveBlock1();
//
if (aPB1->HasEdge()) {
BOPDS_InterfFF& aFF=aFFs(aCPB.IndexInterf());
BOPDS_VectorOfCurve& aVNC=aFF.ChangeCurves();
BOPDS_Curve& aNC=aVNC(aCPB.Index());
BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
aLPBC.Clear();
BOPDS_ListOfPaveBlock aLPBx;
aLPBx.Append(aPB1);
aDMExEdges.Bind(aPB1, aLPBx);
} else {
aSI.SetShapeType(aType);
aSI.SetShape(aS);
@ -624,23 +630,20 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
//
else if (aType==TopAbs_EDGE) {
bHasPaveBlocks=aPDS->HasPaveBlocks(nSx);
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
iX=aCPB.IndexInterf();
iC=aCPB.Index();
aPB1=aCPB.PaveBlock1();
//
bOld = aPB1->HasEdge();
if (bOld) {
BOPDS_ListOfPaveBlock aLPBx;
aDMExEdges.Bind(aPB1, aLPBx);
}
//
if (!bHasPaveBlocks) {
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
aPB1=aCPB.PaveBlock1();
//
if (aPB1->HasEdge()) {
BOPDS_InterfFF& aFF=aFFs(aCPB.IndexInterf());
BOPDS_VectorOfCurve& aVNC=aFF.ChangeCurves();
BOPDS_Curve& aNC=aVNC(aCPB.Index());
BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
aItLPB.Initialize(aLPBC);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBC=aItLPB.Value();
if (aPBC==aPB1) {
aLPBC.Remove(aItLPB);
break;
}
}
if (bOld) {
aDMExEdges.ChangeFind(aPB1).Append(aPB1);
} else {
aSI.SetShapeType(aType);
aSI.SetShape(aSx);
@ -650,17 +653,6 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
}
}
else {
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
iX=aCPB.IndexInterf();
iC=aCPB.Index();
aPB1=aCPB.PaveBlock1();
//modified by NIZHNY-EMV Tue Dec 13 15:49:29 2011
bOld = Standard_False;
if (aPB1->HasEdge()) {
bOld = Standard_True;
}
//modified by NIZHNY-EMV Tue Dec 13 15:49:31 2011
//
BOPDS_InterfFF& aFF=aFFs(iX);
BOPDS_VectorOfCurve& aVNC=aFF.ChangeCurves();
BOPDS_Curve& aNC=aVNC(iC);
@ -669,7 +661,12 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
const BOPDS_ListOfPaveBlock& aLPBx=aPDS->PaveBlocks(nSx);
aNbLPBx=aLPBx.Extent();
//
if (!bOld || !aNbLPBx) {
if (bOld && !aNbLPBx) {
aDMExEdges.ChangeFind(aPB1).Append(aPB1);
continue;
}
//
if (!bOld) {
aItLPB.Initialize(aLPBC);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBC=aItLPB.Value();
@ -681,11 +678,6 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
}
//
if (!aNbLPBx) {
//modified by NIZHNY-EMV Mon Dec 12 15:08:01 2011
if (bOld) {
continue;
}
//modified by NIZHNY-EMV Mon Dec 12 15:08:03 2011
aE=aSx;
//
if (!aMVI.IsBound(aE)) {
@ -772,9 +764,11 @@ static Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
aPBC->SetEdge(iE);
if (bOld) {
aPBC->SetOriginalEdge(aPB1->OriginalEdge());
aDMExEdges.ChangeFind(aPB1).Append(aPBC);
}
else {
aLPBC.Append(aPBC);
}
//
aLPBC.Append(aPBC);
}
}
}
@ -1683,45 +1677,34 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
(BOPDS_ListOfPaveBlock& aLPBC,
(const Handle(BOPDS_PaveBlock)& aPBf,
BOPDS_ListOfPaveBlock& aLPB,
const Standard_Integer nF1,
const Standard_Integer nF2)
{
if (!aLPBC.Extent()) {
return;
}
//
BOPDS_IndexedMapOfPaveBlock aMPB;
Standard_Integer nE;
Handle(BOPDS_PaveBlock) aPBf;
aPBf = aLPBC.First();
nE = aPBf->OriginalEdge();
if (nE == -1) {
return;
}
//
Handle(BOPDS_PaveBlock) aPB, aPB1, aPB2, aPB2n;
Handle(BOPDS_CommonBlock) aCB;
BOPDS_ListOfPaveBlock aLPB;
BOPDS_ListIteratorOfListOfPaveBlock aIt, aIt1, aIt2;
//
FindPaveBlocksByFirst(aLPBC, aLPB);
if (aLPB.Extent() == 1) {
return;
}
BOPDS_IndexedMapOfPaveBlock aMPB;
//
//remove micro edges from aLPB
aIt.Initialize(aLPB);
for (aIt.Next(); aIt.More();) {
for (; aIt.More();) {
aPB = aIt.Value();
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge());
if (IsMicroEdge(aE, myContext)) {
aLPB.Remove(aIt);
continue;
if (!aPB->HasShrunkData()) {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge());
if (IsMicroEdge(aE, myContext)) {
aLPB.Remove(aIt);
continue;
}
}
aIt.Next();
}
//
if (!aLPB.Extent()) {
return;
}
//update face info
myDS->UpdateFaceInfoOn(nF1);
//
@ -1735,8 +1718,6 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
BOPDS_IndexedMapOfPaveBlock& aMPBOn2 = aFI2.ChangePaveBlocksOn();
BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.ChangePaveBlocksIn();
//
//
aPBf = aLPB.First();
if (aPBf->IsCommonBlock()) {
const Handle(BOPDS_CommonBlock)& aCB1 = aPBf->CommonBlock();
const BOPDS_ListOfPaveBlock& aLPB2 = aCB1->PaveBlocks();
@ -1760,7 +1741,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//
//create new pave blocks
aIt.Initialize(aLPB);
for (aIt.Next(); aIt.More(); aIt.Next()) {
for (; aIt.More(); aIt.Next()) {
aPB = aIt.Value();
//
aCB = new BOPDS_CommonBlock;
@ -1785,6 +1766,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
}
//
else {
nE=aPBf->OriginalEdge();
BOPDS_ListOfPaveBlock& aLPB1 = myDS->ChangePaveBlocks(nE);
aIt1.Initialize(aLPB1);
for (; aIt1.More(); aIt1.Next()) {
@ -1796,7 +1778,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
}
//
aIt.Initialize(aLPB);
for (aIt.Next(); aIt.More(); aIt.Next()) {
for (; aIt.More(); aIt.Next()) {
aPB = aIt.Value();
//
Standard_Integer nF = (aMPBOn1.Contains(aPBf) ||
@ -1923,35 +1905,6 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
aMVI.Bind(aV2, nV2);
}
//=======================================================================
//function : FindPaveBlocksByFirst
//purpose :
//=======================================================================
void FindPaveBlocksByFirst(BOPDS_ListOfPaveBlock& aLPBC,
BOPDS_ListOfPaveBlock& aLPB)
{
Standard_Integer nE;
BOPDS_ListIteratorOfListOfPaveBlock aIt;
//
const Handle(BOPDS_PaveBlock)& aPB1 = aLPBC.First();
nE = aPB1->OriginalEdge();
aLPB.Append(aPB1);
//
aLPBC.RemoveFirst();
//
aIt.Initialize(aLPBC);
for (;aIt.More();) {
const Handle(BOPDS_PaveBlock)& aPB = aIt.Value();
if (aPB->OriginalEdge() == nE) {
aLPB.Append(aPB);
aLPBC.Remove(aIt);
continue;
}
aIt.Next();
}
}
//=======================================================================
//function : IsMicroEdge
//purpose : Checks if it is possible to compute shrunk range for the edge <aE>.
@ -1991,27 +1944,37 @@ Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
}
//=======================================================================
//function : IsAnalytic
//purpose : Checks if the faces have analytical surfaces
//function : ToleranceFF
//purpose : Computes the TolFF according to the tolerance value and
// types of the faces.
//=======================================================================
Standard_Boolean IsAnalytic(const TopoDS_Face& aF1,
const TopoDS_Face& aF2)
void ToleranceFF(const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
Standard_Real& aTolFF)
{
Standard_Real aTol1, aTol2;
Standard_Boolean isAna1, isAna2;
//
aTol1 = BRep_Tool::Tolerance(aF1);
aTol2 = BRep_Tool::Tolerance(aF2);
aTolFF = Max(aTol1, aTol2);
//
BRepAdaptor_Surface BAS1(aF1);
BRepAdaptor_Surface BAS2(aF2);
//
Standard_Boolean isAna1 = (BAS1.GetType() == GeomAbs_Plane ||
BAS1.GetType() == GeomAbs_Cylinder ||
BAS1.GetType() == GeomAbs_Cone ||
BAS1.GetType() == GeomAbs_Sphere ||
BAS1.GetType() == GeomAbs_Torus);
Standard_Boolean isAna2 = (BAS2.GetType() == GeomAbs_Plane ||
BAS2.GetType() == GeomAbs_Cylinder ||
BAS2.GetType() == GeomAbs_Cone ||
BAS2.GetType() == GeomAbs_Sphere ||
BAS2.GetType() == GeomAbs_Torus);
return (isAna1 && isAna2);
isAna1 = (BAS1.GetType() == GeomAbs_Plane ||
BAS1.GetType() == GeomAbs_Cylinder ||
BAS1.GetType() == GeomAbs_Cone ||
BAS1.GetType() == GeomAbs_Sphere ||
BAS1.GetType() == GeomAbs_Torus);
//
isAna2 = (BAS2.GetType() == GeomAbs_Plane ||
BAS2.GetType() == GeomAbs_Cylinder ||
BAS2.GetType() == GeomAbs_Cone ||
BAS2.GetType() == GeomAbs_Sphere ||
BAS2.GetType() == GeomAbs_Torus);
//
aTolFF = (isAna1 && isAna2) ? aTolFF : Max(aTolFF, 5.e-6);
}

View File

@ -758,8 +758,8 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
aTV1=aTV - dt;
}
//
aC2D->D0 (aTV, aPV);
aC2D->D0 (aTV1, aPV1);
aC2D->D0 (aTV, aPV);
//
if (aFlag) {//IN
gp_Vec2d aV2DIn(aPV1, aPV);

View File

@ -147,7 +147,8 @@ is
theEdge :Edge from TopoDS;
theFace :Face from TopoDS;
theLCEF :out ListOfCoupleOfShape from BOPTools;
theFaceOff :out Face from TopoDS);
theFaceOff :out Face from TopoDS;
theContext :out Context from BOPInt);
---Purpose: For the face theFace and its edge theEdge
-- finds the face suitable to produce shell.
-- theLCEF - set of faces to search. All faces

View File

@ -78,7 +78,8 @@ static
static
Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
const BOPCol_ListOfShape& thLF,
BOPTools_ListOfCoupleOfShape& theLCFF);
BOPTools_ListOfCoupleOfShape& theLCFF,
Handle(BOPInt_Context)& theContext);
static
TopAbs_Orientation Orientation(const TopoDS_Edge& anE,
const TopoDS_Face& aF);
@ -659,7 +660,7 @@ static
BOPTools_ListOfCoupleOfShape aLCFF;
BOPTools_ListIteratorOfListOfCoupleOfShape aIt;
//
FindFacePairs(theEdge, theLF, aLCFF);
FindFacePairs(theEdge, theLF, aLCFF, theContext);
//
aIt.Initialize(aLCFF);
for (; aIt.More(); aIt.Next()) {
@ -685,32 +686,11 @@ static
const TopoDS_Face& theFace2,
Handle(BOPInt_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Real aT1, aT2, aT;//aD1, aD2,
gp_Pnt aPx, aPF, aPF1, aPF2;
gp_Pnt2d aP2D, aPF2D;
gp_Dir aDNF1, aDNF2;
TopoDS_Edge aE1, aE2;
Handle(Geom_Curve)aC3D;
gp_Vec aVTgt;
TopoDS_Face aFOff;
BOPTools_ListOfCoupleOfShape theLCSOff;
BOPTools_CoupleOfShape aCS1, aCS2;
//
aC3D =BRep_Tool::Curve(theEdge, aT1, aT2);
aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
aC3D->D0(aT, aPx);
//modified by NIZHNY-EMV Wed Sep 21 13:20:31 2011
BOPTools_AlgoTools2D::EdgeTangent(theEdge, aT, aVTgt);
gp_Dir aDTtgt(aVTgt);
aDTtgt.Reverse();
Handle(Geom_Plane) aPL;
aPL = new Geom_Plane(aPx, aDTtgt);
//modified by NIZHNY-EMV Wed Sep 21 13:20:33 2011
//
// 1. PF
//modified by NIZHNY-EMV Wed Oct 12 08:13:43 2011
BOPTools_AlgoTools3D::PointNearEdge (theEdge, theFace, aT, aPF2D, aPF);
//modified by NIZHNY-EMV Wed Oct 12 08:13:47 2011
//
// 2. E1, E2
BOPTools_AlgoTools::GetEdgeOnFace(theEdge, theFace1, aE1);
if (aE1.Orientation()==TopAbs_INTERNAL) {
aE2=aE1;
@ -726,68 +706,27 @@ static
BOPTools_AlgoTools::GetEdgeOnFace(theEdge, theFace2, aE2);
}
//
// 3
bRet=Standard_False;
aCS1.SetShape1(theEdge);
aCS1.SetShape2(theFace);
theLCSOff.Append(aCS1);
//
//modified by NIZHNY-EMV Wed May 25 10:01:51 2011
if (!GetProjectPoint(theFace, aPF, theFace1, aPF1, aDNF1, theContext)) {
BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1);
}
if (!GetProjectPoint(theFace, aPF1, theFace2, aPF2, aDNF2, theContext)) {
BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2);
}
//modified by NIZHNY-EMV Wed May 25 10:01:53 2011
//modified by NIZHNY-EMV Wed Sep 21 13:25:27 2011
//get projects of the points aPF, aPF1, aPF2 on the plane aPL
//927/R7
gp_Pnt aPFx, aPF1x, aPF2x;
CorrectPoint(aPF, aPL, aPFx);
CorrectPoint(aPF1, aPL, aPF1x);
CorrectPoint(aPF2, aPL, aPF2x);
aCS2.SetShape1(aE2);
aCS2.SetShape2(theFace2);
theLCSOff.Append(aCS2);
//
aPF = aPFx; aPF1 = aPF1x; aPF2 = aPF2x;
//modified by NIZHNY-EMV Wed Sep 21 13:25:29 2011
GetFaceOff(aE1, theFace1, theLCSOff, aFOff, theContext);
//
{
Standard_Real aA12, aA1x, aTwoPI;
//
aTwoPI=2.*M_PI;
gp_Vec aVBF (aPx, aPF );
gp_Vec aVBF1(aPx, aPF1);
gp_Vec aVBF2(aPx, aPF2);
//
gp_Dir aDTF1;
gp_Dir aDBF (aVBF);
gp_Dir aDBF1(aVBF1);
gp_Dir aDBF2(aVBF2);
//
aDTF1=aDNF1^aDBF1;
//aA12=aDBF1.AngleWithRef(aDBF2, aDTF1);
aA12=AngleWithRef(aDBF1, aDBF2, aDTF1);
if (aA12<0.) {
aA12=aA12+aTwoPI;
}
//aA1x=aDBF1.AngleWithRef(aDBF , aDTF1);
aA1x=AngleWithRef(aDBF1, aDBF , aDTF1);
if (aA1x<0.) {
aA1x=aA1x+aTwoPI;
}
//
if (aA1x<aA12) {
bRet=!bRet; //TopAbs_IN;
}
}
//
return bRet;
return theFace.IsEqual(aFOff);
}
//=======================================================================
//function : GetFaceOff
//purpose :
//=======================================================================
void BOPTools_AlgoTools::GetFaceOff(const TopoDS_Edge& theE1,
const TopoDS_Face& theF1,
BOPTools_ListOfCoupleOfShape& theLCSOff,
TopoDS_Face& theFOff)
const TopoDS_Face& theF1,
BOPTools_ListOfCoupleOfShape& theLCSOff,
TopoDS_Face& theFOff,
Handle(BOPInt_Context)& theContext)
{
Standard_Real aT, aT1, aT2, aAngle, aTwoPI, aAngleMin;
gp_Pnt aPn1, aPn2, aPx;
@ -825,30 +764,28 @@ static
const TopoDS_Edge& aE2=(*(TopoDS_Edge*)(&aCS.Shape1()));
const TopoDS_Face& aF2=(*(TopoDS_Face*)(&aCS.Shape2()));
//
if (aF2==theF1) {
/*if (aF2==theF1) {
aAngle=M_PI;
}
else if (aF2.IsSame(theF1)) {
aAngle=aTwoPI;
}
else {
//modified by NIZHNY-EMV Tue Sep 06 10:49:54 2011
else {*/
if (!theE1.IsEqual(aE2) ||
!GetProjectPoint(theF1, aPn1, aF2, aPn2, aDN2, theContext)) {
BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge (aE2, aF2, aT, aPn2, aDN2);
CorrectPoint(aPn2, aPL, aPF2x);
gp_Vec aVBF2(aPx, aPF2x);
gp_Dir aDBF2(aVBF2);
//modified by NIZHNY-EMV Tue Sep 06 10:49:56 2011
//aDN2.Reverse();
// Angle
//aAngle=AngleWithRef(aDN1, aDN2, aDTtgt);
aAngle=AngleWithRef(aDBF, aDBF2, aDTF);
//modified by NIZHNY-EMV Fri Oct 14 09:39:45 2011
//
if(aAngle<0.) {
aAngle=aTwoPI+aAngle;
}
}
CorrectPoint(aPn2, aPL, aPF2x);
gp_Vec aVBF2(aPx, aPF2x);
gp_Dir aDBF2(aVBF2);
//Angle
aAngle=AngleWithRef(aDBF, aDBF2, aDTF);
//
if(aAngle<0.) {
aAngle=aTwoPI+aAngle;
}
//}
if (aAngle<aAngleMin){
aAngleMin=aAngle;
theFOff=aF2;
@ -1503,7 +1440,8 @@ static
//=======================================================================
Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
const BOPCol_ListOfShape& thLF,
BOPTools_ListOfCoupleOfShape& theLCFF)
BOPTools_ListOfCoupleOfShape& theLCFF,
Handle(BOPInt_Context)& theContext)
{
Standard_Boolean bFound;
Standard_Integer i, aNbCEF;
@ -1561,7 +1499,7 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
}
//
// F2
BOPTools_AlgoTools::GetFaceOff(aE1, aF1, aLCEFx, aF2);
BOPTools_AlgoTools::GetFaceOff(aE1, aF1, aLCEFx, aF2, theContext);
//
aCFF.SetShape1(aF1);
aCFF.SetShape2(aF2);
@ -1764,7 +1702,7 @@ Standard_Real fsqrt(Standard_Real val)
Handle(Geom_Surface) aS, aS1;
GeomAbs_SurfaceType aTS, aTS1;
Handle(Geom_CylindricalSurface) aCS, aCS1;
Standard_Real aR, aR1, dR, aU, aV;
Standard_Real aR, aR1, dR, aU, aV, aDMin;
//
aS = BRep_Tool::Surface(aF);
aS1 = BRep_Tool::Surface(aF1);
@ -1803,6 +1741,10 @@ Standard_Real fsqrt(Standard_Real val)
if (!aProjector.IsDone()) {
return bRet;
}
aDMin = aProjector.LowerDistance();
if (aDMin > dR) {
return bRet;
}
aProjector.LowerDistanceParameters(aU, aV);
Handle(Geom_Surface) aS = BRep_Tool::Surface(aF1);
BOPTools_AlgoTools3D::GetNormalToSurface (aS, aU, aV, aDNF1);

View File

@ -2,4 +2,4 @@ restore [locate_data_file a2] a
restore [locate_data_file b2_bsect] b
bsection result a b -n2d
set length 48.4314
set length 25.1327

View File

@ -1,4 +1,3 @@
puts "TODO OCC22911 ALL: Error : The bsection is not valid."
restore [locate_data_file a49] a
restore [locate_data_file b50] b
bsection result a b