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

0027179: The algorithm of sharing edges in Boolean operation should be improved

1. New sharing algorithm has been implemented. If intermediate point of some edge is included in the tube with center taken in another edge and radius equaled to maximal vertex-tolerance of both edges then these two edges are considered to be shared. This know-how touches edges only, which have common blocks with interfered faces. If they do not have any common-blocks the algorithm will work as before.

2. Interface of BOPAlgo_PaveFiller::IsExistingPaveBlock(...) method has been changed.

Creation of test case for issues #27128 and #27179

Adjusting some test cases according to their new behavior, because they are IMPROVEMENTS really (TODOs have been deleted).
This commit is contained in:
nbv 2016-02-29 17:52:20 +03:00 committed by bugmaster
parent 0d42485334
commit 93e38faa3b
12 changed files with 98 additions and 45 deletions

View File

@ -193,7 +193,7 @@ protected:
const Standard_Real theTolR3D, const BOPDS_IndexedMapOfPaveBlock& theMPB,
Handle(BOPDS_PaveBlock)& thePBOut, Standard_Real& theTolNew);
Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const Standard_Real theTolR3D, const BOPCol_ListOfInteger& theLSE);
Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const BOPCol_ListOfInteger& theLSE);
//! Treatment of section edges.

View File

@ -516,7 +516,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
continue;
}
//
bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aLSE);
bExist=IsExistingPaveBlock(aPB, aNC, aLSE);
if (bExist) {
continue;
}
@ -1091,7 +1091,6 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
(const Handle(BOPDS_PaveBlock)& thePB,
const BOPDS_Curve& theNC,
const Standard_Real theTolR3D,
const BOPCol_ListOfInteger& theLSE)
{
Standard_Boolean bRet=Standard_True;
@ -1101,16 +1100,24 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
}
//
Standard_Real aT1, aT2, aTm, aTx, aTol, aDist;
Standard_Integer nE, iFlag;
Standard_Integer nE, iFlag, nV1, nV2;
gp_Pnt aPm;
Bnd_Box aBoxPm;
BOPCol_ListIteratorOfListOfInteger aItLI;
//
thePB->Range(aT1, aT2);
thePB->Indices(nV1, nV2);
const TopoDS_Vertex &aV1 = TopoDS::Vertex(myDS->Shape(nV1)),
&aV2 = TopoDS::Vertex(myDS->Shape(nV2));
const Standard_Real aTolV1 = BRep_Tool::Tolerance(aV1),
aTolV2 = BRep_Tool::Tolerance(aV2);
aTol = Max(aTolV1, aTolV2);
aTm=IntTools_Tools::IntermediatePoint (aT1, aT2);
theNC.Curve().D0(aTm, aPm);
aBoxPm.Add(aPm);
aBoxPm.Enlarge(theTolR3D);
aBoxPm.Enlarge(aTol);
//
aItLI.Initialize(theLSE);
for (; aItLI.More(); aItLI.Next()) {
@ -1121,9 +1128,8 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
const Bnd_Box& aBoxE=aSIE.Box();
if (!aBoxE.IsOut(aBoxPm)) {
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
aTol = BRep_Tool::Tolerance(aE);
aTol = aTol > theTolR3D ? aTol : theTolR3D;
iFlag=myContext->ComputePE(aPm, aTol, aE, aTx, aDist);
const Standard_Real aTol1 = Max(BRep_Tool::Tolerance(aE), aTol);
iFlag=myContext->ComputePE(aPm, aTol1, aE, aTx, aDist);
if (!iFlag) {
return bRet;
}
@ -1148,32 +1154,38 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
Standard_Real aT1, aT2, aTm, aTx;
Standard_Integer nSp, iFlag1, iFlag2, nV11, nV12, nV21, nV22, i, aNbPB;
gp_Pnt aP1, aPm, aP2;
Bnd_Box aBoxP1, aBoxPm, aBoxP2;
Bnd_Box aBoxP1, aBoxPm, aBoxP2, aBoxTmp;
//
bRet=Standard_False;
const IntTools_Curve& aIC=theNC.Curve();
//
thePB->Range(aT1, aT2);
thePB->Indices(nV11, nV12);
const Standard_Real aTolV11 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV11)));
const Standard_Real aTolV12 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV12)));
const Standard_Real aTolV1 = Max(aTolV11, aTolV12);
//first point
aIC.D0(aT1, aP1);
aBoxP1.Add(aP1);
aBoxP1.Enlarge(theTolR3D);
aBoxP1.Enlarge(aTolV11);
//intermediate point
aTm=IntTools_Tools::IntermediatePoint (aT1, aT2);
aIC.D0(aTm, aPm);
aBoxPm.Add(aPm);
aBoxPm.Enlarge(theTolR3D);
//last point
aIC.D0(aT2, aP2);
aBoxP2.Add(aP2);
aBoxP2.Enlarge(theTolR3D);
aBoxP2.Enlarge(aTolV12);
//
theTolNew = 0.;
aNbPB = theMPBOnIn.Extent();
for (i = 1; i <= aNbPB; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i);
aPB->Indices(nV21, nV22);
const Standard_Real aTolV21 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV21)));
const Standard_Real aTolV22 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV22)));
const Standard_Real aTolV2 = Max(aTolV21, aTolV22);
nSp=aPB->Edge();
if (nSp < 0)
continue;
@ -1187,21 +1199,28 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
(!aBoxSp.IsOut(aBoxP2) ? 1 : 0);
if (iFlag1 && iFlag2) {
Standard_Real aDist;
if (aBoxSp.IsOut(aBoxPm) || myContext->ComputePE(aPm,
theTolR3D,
aSp,
aTx, theTolNew)) {
const Standard_Real aRealTol = myDS->IsCommonBlock(aPB) ?
Max(aTolV1, aTolV2) : theTolR3D;
aBoxTmp = aBoxPm;
aBoxTmp.Enlarge(aRealTol);
if (aBoxSp.IsOut(aBoxTmp) || myContext->ComputePE(aPm,
aRealTol,
aSp,
aTx, theTolNew)) {
continue;
}
//
if (iFlag1 == 1) {
iFlag1 = !myContext->ComputePE(aP1, theTolR3D, aSp, aTx, aDist);
iFlag1 = !myContext->ComputePE(aP1, aRealTol, aSp, aTx, aDist);
if (theTolNew < aDist)
theTolNew = aDist;
}
//
if (iFlag2 == 1) {
iFlag2 = !myContext->ComputePE(aP2, theTolR3D, aSp, aTx, aDist);
iFlag2 = !myContext->ComputePE(aP2, aRealTol, aSp, aTx, aDist);
if (theTolNew < aDist)
theTolNew = aDist;
}
@ -1811,7 +1830,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
aTolV = BRep_Tool::Tolerance(aVToUpdate);
aP2 = BRep_Tool::Pnt(aVToUpdate);
aDist = aP1.Distance(aP2);
aTolVNew = aDist - aTolV2;
aTolVNew = Max(aDist - aTolV2, aTolR3D);
//
if (aTolVNew > aTolV) {
BRep_Builder aBB;

View File

@ -1,7 +1,5 @@
# Original bug : pro14260
# Date : 21 Sept 98
puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO #22911 ALL: Error : The area of result shape is"
restore [locate_data_file CTO900_pro14260c.rle] c
restore [locate_data_file pro14260d.rle] d

View File

@ -6,8 +6,6 @@ puts ""
## Exception in command 'section'
###############################################
puts "TODO #OCC26815 ALL: Error : The length of result shape is"
restore [locate_data_file OCC1255.brep] a
checkshape a
@ -16,7 +14,7 @@ mkface f1 p1
bsection result a f1
checkprops result -l 5840.24
checkprops result -l 5837.18
checkshape result
checksection result
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -7,8 +7,6 @@ puts ""
# (This script tests new topology)
###############################################
puts "TODO #OCC26815 ALL: Error : The length of result shape is"
restore [locate_data_file OCC1255.brep] a
checkshape a
@ -21,7 +19,7 @@ if { [catch {bop a f1 } ] } {
bopsection result
}
checkprops result -l 5840.24
checkprops result -l 5837.18
checkshape result
checksection result
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -1,6 +1,3 @@
puts "TODO OCC25829 ALL: Error : The area of result shape is"
puts "TODO OCC25829 ALL: Faulty shapes in variables faulty_1 to"
puts "============"
puts "OCC697"
puts "============"
@ -27,7 +24,7 @@ if { [catch {bfuse result b2 b3} catch_result] } {
puts "Faulty : an exception was caught"
}
checkprops result -s 25357.5
checkprops result -s 26041.9
checkshape result
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -1,6 +1,3 @@
puts "TODO OCC25829 ALL: Error : The area of result shape is"
puts "TODO OCC25829 ALL: Faulty shapes in variables faulty_1 to"
puts "============"
puts "OCC697"
puts "============"
@ -21,6 +18,6 @@ checkshape b3
if { [catch {bfuse result b3 b2} catch_result] } {
puts "Faulty OCC697"
}
checkprops result -s 25357.5
checkprops result -s 26041.9
checkshape result
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@ -1,6 +1,3 @@
puts "TODO OCC25829 ALL: Error : The area of result shape is"
puts "TODO OCC25829 ALL: Faulty shapes in variables faulty_1 to"
puts "============"
puts "OCC697"
puts "============"
@ -22,6 +19,6 @@ bop b2 b3
if { [catch {bopfuse result} catch_result] } {
puts "Faulty OCC697 "
}
checkprops result -s 25357.5
checkprops result -s 26041.9
checkshape result
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@ -1,6 +1,3 @@
puts "TODO OCC25829 ALL: Error : The area of result shape is"
puts "TODO OCC25829 ALL: Faulty shapes in variables faulty_1 to"
puts "============"
puts "OCC697"
puts "============"
@ -22,6 +19,6 @@ bop b3 b2
if { [catch {bopfuse result} catch_result] } {
puts "Faulty OCC697"
}
checkprops result -s 25357.5
checkprops result -s 26041.9
checkshape result
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@ -1,5 +1,3 @@
puts "TODO OCC26999 ALL: Error : .*The area .*is"
puts "========"
puts "OCC772"
puts "SAM1643"

View File

@ -0,0 +1,23 @@
puts "============"
puts "OCC27128"
puts "============"
puts ""
###############################
## The algorithm of sharing edges in Boolean operation should be improved
###############################
plane pl 0.195808075898442, -0.229262227170656, 4.05546403129991 0 0 1
psphere s1 pl 0.03101752454
restore [locate_data_file bug27128-Helix_Pipe.brep] s2
settolerance s1 2.0e-6
bfuse result s1 s2
checkshape result
smallview
donly s1
fit
donly result
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,31 @@
puts "============"
puts "OCC27179"
puts "============"
puts ""
###############################
## The algorithm of sharing edges in Boolean operation should be improved
###############################
plane pl 0.195808075898442, -0.229262227170656, 4.05546403129991 0 0 1
psphere s1 pl 0.03101752454
restore [locate_data_file bug27128-Helix_Pipe.brep] s2
settolerance s1 2.0e-6
explode s1 f
explode s2 f
bsection result s1_1 s2_2
smallview
donly s1
fit
donly result
if { [string compare -nocase [checksection result] " nb alone Vertices : 0\n\n"] } {
puts "ERROR: the section is not closed"
} else {
puts "The section is OK"
}
checkview -screenshot -2d -path ${imagedir}/${test_image}.png