1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0024247: Wrong result obtained by General Fuse algorithm

v0.0

I. New features:
no new features

II. Changes:
II.1. class BOPAlgo_PaveFiller
   - method:
void BOPAlgo_PaveFiller::PerformFF()
Prepare data to the filter BOPAlgo_PaveFiller::::CheckPlanes(...).

   - method:
Standard_Boolean
  BOPAlgo_PaveFiller::CheckPlanes(const Standard_Integer nF1,
			  const Standard_Integer nF2)const
1)The contents of the filter has been updated by all vertices of the faces images.
2)The method declared as const

III. Modified entities:
packages:
BOPAlgo

Test cases for issue CR24247
This commit is contained in:
pkv 2013-10-17 12:17:35 +04:00 committed by bugmaster
parent 2b21c64155
commit af4e6dabcb
3 changed files with 74 additions and 97 deletions

View File

@ -361,9 +361,9 @@ is
is protected; is protected;
---Purpose: ---Purpose:
-- Updates tolerance of vertex with index <nV> -- Updates tolerance of vertex with index <nV>
-- to make it interfere with face with index <nF> -- to make it interfere with face with index <nF>
CheckPlanes(me:out; CheckPlanes(me;
nF1 : Integer from Standard; nF1 : Integer from Standard;
nF2 : Integer from Standard) nF2 : Integer from Standard)
returns Boolean from Standard returns Boolean from Standard

View File

@ -121,6 +121,7 @@ void BOPAlgo_PaveFiller::PerformFF()
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;
BRepAdaptor_Surface aBAS1, aBAS2; BRepAdaptor_Surface aBAS1, aBAS2;
BOPCol_MapOfInteger aMI;
// //
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF(); BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aFFs.SetStartSize(iSize); aFFs.SetStartSize(iSize);
@ -149,6 +150,15 @@ void BOPAlgo_PaveFiller::PerformFF()
aBAS2.GetType() == GeomAbs_Plane) { aBAS2.GetType() == GeomAbs_Plane) {
Standard_Boolean bToIntersect; Standard_Boolean bToIntersect;
// //
if (aMI.Add(nF1)) {
myDS->UpdateFaceInfoOn(nF1);
myDS->UpdateFaceInfoIn(nF1);
}
if (aMI.Add(nF2)) {
myDS->UpdateFaceInfoOn(nF2);
myDS->UpdateFaceInfoIn(nF2);
}
//
bToIntersect = CheckPlanes(nF1, nF2); bToIntersect = CheckPlanes(nF1, nF2);
if (!bToIntersect) { if (!bToIntersect) {
myDS->AddInterf(nF1, nF2); myDS->AddInterf(nF1, nF2);
@ -516,9 +526,8 @@ void BOPAlgo_PaveFiller::PerformFF()
// //
Standard_Boolean bHasPaveBlocks, bOld; Standard_Boolean bHasPaveBlocks, bOld;
Standard_Integer iErr, nSx, nVSD, iX, iP, iC, j, nV, iV = 0, iE, k; Standard_Integer iErr, nSx, nVSD, iX, iP, iC, j, nV, iV = 0, iE, k;
Standard_Integer jx; Standard_Integer jx, aNbLPBx;
Standard_Real aT; Standard_Real aT;
Standard_Integer aNbLPBx;
TopAbs_ShapeEnum aType; TopAbs_ShapeEnum aType;
TopoDS_Shape aV, aE; TopoDS_Shape aV, aE;
BOPCol_ListIteratorOfListOfShape aItLS; BOPCol_ListIteratorOfListOfShape aItLS;
@ -1964,91 +1973,42 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//function : CheckPlanes //function : CheckPlanes
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes(const Standard_Integer nF1, Standard_Boolean
const Standard_Integer nF2) BOPAlgo_PaveFiller::CheckPlanes(const Standard_Integer nF1,
const Standard_Integer nF2)const
{ {
Standard_Boolean bToIntersect; Standard_Boolean bToIntersect;
// Standard_Integer i, nV2, iCnt;
bToIntersect = 1;
//
//1. Find shared vertices
Standard_Integer nS1, nS2, iCountV, iCountE;
BOPCol_MapOfInteger aMI1, aMI2;
BOPCol_MapIteratorOfMapOfInteger aIt; BOPCol_MapIteratorOfMapOfInteger aIt;
// //
iCountV = 0; bToIntersect=Standard_False;
iCountE = 0;
GetFullFaceMap(nF1, aMI1);
GetFullFaceMap(nF2, aMI2);
// //
//1. Find shared sub shapes const BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
aIt.Initialize(aMI1); const BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
aIt.Next();
for (; aIt.More(); aIt.Next()) {
nS1 = aIt.Value();
if (aMI2.Contains(nS1)) {
const TopoDS_Shape& aS = myDS->Shape(nS1);
if (aS.ShapeType() == TopAbs_EDGE) {
++iCountE;
iCountV-=2;
} else {
++iCountV;
}
}
}
// //
if ((iCountV + iCountE) > 1) { const BOPCol_MapOfInteger& aMVIn1=aFI1.VerticesIn();
return bToIntersect; const BOPCol_MapOfInteger& aMVOn1=aFI1.VerticesOn();
}
// //
//2. Find intersecting sub shapes iCnt=0;
Standard_Integer aNb, i, k; for (i=0; (i<2 && !bToIntersect); ++i) {
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE(); const BOPCol_MapOfInteger& aMV2=(!i) ? aFI2.VerticesIn()
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF(); : aFI2.VerticesOn();
for (k=0; k<2; ++k) { //
aNb = !k ? aEEs.Extent() : aEFs.Extent(); aIt.Initialize(aMV2);
for (i = 0; i < aNb; ++i) {
BOPDS_Interf *aInt = !k ? (BOPDS_Interf*) (&aEEs(i)) :
(BOPDS_Interf*) (&aEFs(i));
aInt->Indices(nS1, nS2);
if (aMI1.Contains(nS1) && aMI2.Contains(nS2) ||
aMI1.Contains(nS2) && aMI2.Contains(nS1)) {
const IntTools_CommonPrt& aCPart = !k ? aEEs(i).CommonPart() :
aEFs(i).CommonPart();
if (aCPart.Type() == TopAbs_EDGE) {
++iCountE;
} else {
++iCountV;
}
if ((iCountV + iCountE) > 1) {
return bToIntersect;
}
}
}
}
//
BOPCol_MapOfInteger aMI;
//
for (k=0; k<2; ++k) {
aMI = !k ? aMI1 : aMI2;
nS2 = !k ? nF2 : nF1;
aIt.Initialize(aMI);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
nS1 = aIt.Value(); nV2=aIt.Value();
const TopoDS_Shape& aV = myDS->Shape(nS1); if (aMVIn1.Contains(nV2) || aMVOn1.Contains(nV2)) {
if (aV.ShapeType() == TopAbs_VERTEX) { ++iCnt;
if (myDS->HasInterf(nS1, nS2) || if (iCnt>1) {
myDS->HasInterfShapeSubShapes(nS1, nS2)) { bToIntersect=!bToIntersect;
++iCountV; break;
} }
} }
} }
} }
bToIntersect = ((iCountV + iCountE) > 1);
// //
return bToIntersect; return bToIntersect;
} }
//======================================================================= //=======================================================================
//function : ToleranceFF //function : ToleranceFF
//purpose : Computes the TolFF according to the tolerance value and //purpose : Computes the TolFF according to the tolerance value and
@ -2081,24 +2041,3 @@ Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes(const Standard_Integer nF1,
aTolFF = Max(aTolFF, 5.e-6); aTolFF = Max(aTolFF, 5.e-6);
} }
} }
// DEB f
/*
{
BOPDS_DataMapIteratorOfDataMapOfShapeCoupleOfPaveBlocks aItx;
TopoDS_Compound aCx;
//
BRep_Builder aBBx;
aBBx.MakeCompound(aCx);
//
aItx.Initialize(theMSCPB);
for (; aItx.More(); aItx.Next()) {
const TopoDS_Shape& aSx=aItx.Key();
aBBx.Add(aCx, aSx);
}
int a=0;
BRepTools::Write(aCx, "cx");
}
*/
// DEB t

View File

@ -0,0 +1,38 @@
puts "========="
puts "OCC24247"
puts "========="
puts ""
###########################################################
# Wrong result obtained by General Fuse algorithm
###########################################################
restore [locate_data_file bug24247_Box.brep] b1
restore [locate_data_file bug24247_InsideBox.brep] b2
restore [locate_data_file bug24247_c1.brep] b3
restore [locate_data_file bug24247_c2.brep] b4
restore [locate_data_file bug24247_c3.brep] b5
restore [locate_data_file bug24247_plane_1.brep] b6
restore [locate_data_file bug24247_plane_2.brep] b7
restore [locate_data_file bug24247_plane_3.brep] b8
restore [locate_data_file bug24247_plane_4.brep] b9
bclearobjects
bcleartools
baddobjects b1 b2 b3 b4 b5 b6 b7 b8 b9
bfillds
bbuild result
set square 260611
set nb_v_good 44
set nb_e_good 108
set nb_w_good 74
set nb_f_good 74
set nb_sh_good 17
set nb_sol_good 17
set nb_compsol_good 0
set nb_compound_good 1
set nb_shape_good 335
set 2dviewer 1