mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0024905: Boolean cut produced invalid result
The method BOPAlgo_PaveFiller::PutClosingPaveOnCurve(...) has been improved in order to take into account extended vertex tolerance.
This commit is contained in:
parent
5ada54fb79
commit
a8b8f90dd3
@ -2740,42 +2740,63 @@ void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
|
|||||||
aIC.Bounds(aT[0], aT[1], aP[0], aP[1]);
|
aIC.Bounds(aT[0], aT[1], aP[0], aP[1]);
|
||||||
|
|
||||||
// Find the pave which has been put at one of the ends
|
// Find the pave which has been put at one of the ends
|
||||||
|
BOPDS_Pave aPave;
|
||||||
|
// Index of the vertex put at one of the ends
|
||||||
Standard_Integer nV = -1;
|
Standard_Integer nV = -1;
|
||||||
// Keep the opposite parameter
|
// Keep the opposite parameter
|
||||||
Standard_Real aTOp = 0.;
|
Standard_Real aTOp = 0.;
|
||||||
|
// Keep the opposite bounding point
|
||||||
Standard_Boolean bFound = Standard_False;
|
gp_Pnt aPOp;
|
||||||
|
|
||||||
Handle(BOPDS_PaveBlock)& aPB = aNC.ChangePaveBlock1();
|
Handle(BOPDS_PaveBlock)& aPB = aNC.ChangePaveBlock1();
|
||||||
BOPDS_ListOfPave& aLP = aPB->ChangeExtPaves();
|
BOPDS_ListOfPave& aLP = aPB->ChangeExtPaves();
|
||||||
BOPDS_ListIteratorOfListOfPave aItLP(aLP);
|
BOPDS_ListIteratorOfListOfPave aItLP(aLP);
|
||||||
for (; aItLP.More() && !bFound; aItLP.Next())
|
for (; aItLP.More() && (nV < 0); aItLP.Next())
|
||||||
{
|
{
|
||||||
const BOPDS_Pave& aPC = aItLP.Value();
|
aPave = aItLP.Value();
|
||||||
Standard_Real aTC = aPC.Parameter();
|
Standard_Real aTC = aPave.Parameter();
|
||||||
for (Standard_Integer j = 0; j < 2; ++j)
|
for (Standard_Integer j = 0; j < 2; ++j)
|
||||||
{
|
{
|
||||||
if (Abs(aTC - aT[j]) < Precision::PConfusion())
|
if (Abs(aTC - aT[j]) < Precision::PConfusion())
|
||||||
{
|
{
|
||||||
nV = aPC.Index();
|
nV = aPave.Index();
|
||||||
aTOp = (!j) ? aT[1] : aT[0];
|
aTOp = (!j) ? aT[1] : aT[0];
|
||||||
bFound = Standard_True;
|
aPOp = (!j) ? aP[1] : aP[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bFound)
|
if (nV < 0)
|
||||||
|
// No paves on the bounds of the curve
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Check if the curve is closed using the tolerance
|
// Check if the curve is closed using the tolerance
|
||||||
// of found vertex
|
// of found vertex
|
||||||
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV));
|
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV));
|
||||||
const Standard_Real aTolV = BRep_Tool::Tolerance(aV);
|
Standard_Real aTolV = BRep_Tool::Tolerance(aV);
|
||||||
|
gp_Pnt aPV = BRep_Tool::Pnt(aV);
|
||||||
|
// Tolerance for the point on the curve
|
||||||
|
Standard_Real aTolP = Max(aNC.Tolerance(), aNC.TangentialTolerance());
|
||||||
|
aTolP += Precision::Confusion();
|
||||||
|
|
||||||
Standard_Real aDist = aP[0].Distance(aP[1]);
|
const Standard_Real aDistVP = aPV.Distance(aPOp);
|
||||||
if (aDist > aTolV)
|
if (aDistVP > aTolV + aTolP)
|
||||||
|
{
|
||||||
|
// Curve is not closed
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aDistVP > aTolV)
|
||||||
|
{
|
||||||
|
Standard_Integer nVn = UpdateVertex(nV, aDistVP);
|
||||||
|
if (nVn != nV)
|
||||||
|
{
|
||||||
|
aPave.SetIndex(nVn);
|
||||||
|
nV = nVn;
|
||||||
|
}
|
||||||
|
aTolV = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV)));
|
||||||
|
}
|
||||||
|
|
||||||
// Check if there will be valid range on the curve
|
// Check if there will be valid range on the curve
|
||||||
Standard_Real aFirst, aLast;
|
Standard_Real aFirst, aLast;
|
||||||
@ -2784,15 +2805,17 @@ void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
|
|||||||
aT[1], aP[1], aTolV,
|
aT[1], aP[1], aTolV,
|
||||||
aFirst, aLast))
|
aFirst, aLast))
|
||||||
{
|
{
|
||||||
|
// No valid range
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add closing pave to the curve
|
// Add closing pave to the curve
|
||||||
BOPDS_Pave aPave;
|
BOPDS_Pave aNewPave;
|
||||||
aPave.SetIndex(nV);
|
aNewPave.SetIndex(nV);
|
||||||
aPave.SetParameter(aTOp);
|
aNewPave.SetParameter(aTOp);
|
||||||
aLP.Append(aPave);
|
aLP.Append(aNewPave);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : PreparePostTreatFF
|
//function : PreparePostTreatFF
|
||||||
//purpose :
|
//purpose :
|
||||||
|
67
tests/bugs/modalg_7/bug24905
Normal file
67
tests/bugs/modalg_7/bug24905
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "0024905: Boolean cut produced invalid result"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
circle c1 0 0 0 0 -1 0 75
|
||||||
|
circle c2 0 0 0 0 -1 0 65
|
||||||
|
mkedge c1 c1
|
||||||
|
mkedge c2 c2
|
||||||
|
wire c1 c1
|
||||||
|
wire c2 c2
|
||||||
|
orientation c2 R
|
||||||
|
mkplane f1 c1 1
|
||||||
|
add c2 f1
|
||||||
|
prism p1 f1 0 1000 0
|
||||||
|
trotate p1 0 0 0 0 0 1 180
|
||||||
|
circle c3 50 500 -2000 0 0 1 50
|
||||||
|
mkedge c3 c3
|
||||||
|
wire c3 c3
|
||||||
|
mkplane f2 c3 1
|
||||||
|
prism p2 f2 0 0 4000
|
||||||
|
trotate p2 0 500 0 1 0 0 -77
|
||||||
|
trotate p2 0 0 0 0 0 1 180
|
||||||
|
|
||||||
|
bclearobjects
|
||||||
|
bcleartools
|
||||||
|
baddobjects p1
|
||||||
|
baddtools p2
|
||||||
|
|
||||||
|
bfillds
|
||||||
|
|
||||||
|
bbop r_0 0
|
||||||
|
bbop r_1 1
|
||||||
|
bbop r_2 2
|
||||||
|
bbop r_3 3
|
||||||
|
bbop r_4 4
|
||||||
|
|
||||||
|
for {set i 0} {$i <= 4} {incr i} {
|
||||||
|
checkshape r_$i
|
||||||
|
if {[regexp "Faulties" [ bopargcheck r_$i ]]} {
|
||||||
|
puts "Error: bopargcheck has found some faulties in r_$i"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
checknbshapes r_0 -solid 1 -shell 1 -face 5 -wire 6
|
||||||
|
checkprops r_0 -s 196255 -v 857818
|
||||||
|
|
||||||
|
checknbshapes r_1 -solid 1 -shell 1 -face 9 -wire 13
|
||||||
|
checkprops r_1 -s 1.96453e+06 -v 3.49563e+07
|
||||||
|
|
||||||
|
checknbshapes r_2 -solid 1 -shell 1 -face 7 -wire 11
|
||||||
|
checkprops r_2 -s 742474 -v 3.54041e+06
|
||||||
|
|
||||||
|
checknbshapes r_3 -solid 2 -shell 2 -face 7 -wire 8
|
||||||
|
checkprops r_3 -s 1.41831e+06 -v 3.05581e+07
|
||||||
|
|
||||||
|
checknbshapes r_4 -vertex 8 -edge 8
|
||||||
|
checkprops r_4 -l 3965.07
|
||||||
|
|
||||||
|
checksection r_4 -r 0
|
||||||
|
|
||||||
|
# CUT
|
||||||
|
copy r_2 result
|
||||||
|
checkmaxtol result -min_tol 1.0e-4
|
||||||
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user