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

0028795: Boolean operations corrupt the p-curve of the source planar face if "non-destructive" option is switched off

Now, the range of BRep_CurveRepresentation of the edge is updated if at least one of its boundary is not infinite (earlier, it was updated if all two boundaries are not infinite only).
This commit is contained in:
nbv 2017-05-29 10:42:30 +03:00 committed by apv
parent c765ab619b
commit b7a71e36aa
2 changed files with 92 additions and 55 deletions

View File

@ -108,9 +108,7 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr); BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_CurveRepresentation) cr; Handle(BRep_CurveRepresentation) cr;
Handle(BRep_GCurve) GC; Handle(BRep_GCurve) GC;
Standard_Real f = 0.,l = 0.; Standard_Real f = -Precision::Infinite(), l = Precision::Infinite();
Standard_Boolean rangeFound = Standard_False;
// search the range of the 3d curve // search the range of the 3d curve
// and remove any existing representation // and remove any existing representation
@ -124,13 +122,6 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
// see lbo & flo, to determine whether range is defined // see lbo & flo, to determine whether range is defined
// compare first and last parameters with default values. // compare first and last parameters with default values.
GC->Range(f, l); GC->Range(f, l);
//lvt 15/6/99: On enleve la comparaison de reels infinis.
Standard_Boolean undefined = (Precision::IsPositiveInfinite(l) ||
Precision::IsNegativeInfinite(f));
if (!undefined) {
rangeFound = Standard_True;
}
} }
if (GC->IsCurveOnSurface(S,L)) { if (GC->IsCurveOnSurface(S,L)) {
// remove existing curve on surface // remove existing curve on surface
@ -150,10 +141,19 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
if (!C.IsNull()) { if (!C.IsNull()) {
Handle(BRep_CurveOnSurface) COS = new BRep_CurveOnSurface(C, S, L); Handle(BRep_CurveOnSurface) COS = new BRep_CurveOnSurface(C, S, L);
// test if there is already a range Standard_Real aFCur = 0.0, aLCur = 0.0;
if (rangeFound) { COS->Range(aFCur, aLCur);
COS->SetRange(f,l); if (!Precision::IsInfinite(f))
{
aFCur = f;
} }
if (!Precision::IsInfinite(l))
{
aLCur = l;
}
COS->SetRange(aFCur, aLCur);
lcr.Append(COS); lcr.Append(COS);
} }
} }
@ -174,8 +174,7 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr); BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_CurveRepresentation) cr; Handle(BRep_CurveRepresentation) cr;
Handle(BRep_GCurve) GC; Handle(BRep_GCurve) GC;
Standard_Real f = 0.,l = 0.; Standard_Real f = -Precision::Infinite(), l = Precision::Infinite();
Standard_Boolean rangeFound = Standard_False;
// search the range of the 3d curve // search the range of the 3d curve
// and remove any existing representation // and remove any existing representation
@ -190,13 +189,6 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
// see lbo & flo, to determine whether range is defined // see lbo & flo, to determine whether range is defined
// compare first and last parameters with default values. // compare first and last parameters with default values.
GC->Range(f, l); GC->Range(f, l);
//lvt 15/6/99: On enleve la comparaison de reels infinis.
Standard_Boolean undefined = (Precision::IsPositiveInfinite(l) ||
Precision::IsNegativeInfinite(f));
if (!undefined) {
rangeFound = Standard_True;
}
} }
if (GC->IsCurveOnSurface(S,L)) { if (GC->IsCurveOnSurface(S,L)) {
// remove existing curve on surface // remove existing curve on surface
@ -216,10 +208,19 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
if (! C.IsNull()) { if (! C.IsNull()) {
Handle(BRep_CurveOnSurface) COS = new BRep_CurveOnSurface(C,S,L); Handle(BRep_CurveOnSurface) COS = new BRep_CurveOnSurface(C,S,L);
// test if there is already a range Standard_Real aFCur = 0.0, aLCur = 0.0;
if (rangeFound) { COS->Range(aFCur, aLCur);
COS->SetRange(f,l); if (!Precision::IsInfinite(f))
{
aFCur = f;
} }
if (!Precision::IsInfinite(l))
{
aLCur = l;
}
COS->SetRange(aFCur, aLCur);
COS->SetUVPoints(Pf, Pl); COS->SetUVPoints(Pf, Pl);
lcr.Append(COS); lcr.Append(COS);
} }
@ -241,20 +242,13 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr); BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_CurveRepresentation) cr; Handle(BRep_CurveRepresentation) cr;
Handle(BRep_GCurve) GC; Handle(BRep_GCurve) GC;
Standard_Real f = 0.,l = 0.; Standard_Real f = -Precision::Infinite(), l = Precision::Infinite();
Standard_Boolean rangeFound = Standard_False;
while (itcr.More()) { while (itcr.More()) {
GC = Handle(BRep_GCurve)::DownCast(itcr.Value()); GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
if ( !GC.IsNull() ) { if ( !GC.IsNull() ) {
if (GC->IsCurve3D()) { if (GC->IsCurve3D()) {
GC->Range(f,l); GC->Range(f,l);
Standard_Boolean undefined = (Precision::IsPositiveInfinite(l) ||
Precision::IsNegativeInfinite(f));
if (!undefined) {
rangeFound = Standard_True;
}
} }
Standard_Boolean iscos = GC->IsCurveOnSurface(S,L); Standard_Boolean iscos = GC->IsCurveOnSurface(S,L);
if (iscos) break; if (iscos) break;
@ -270,12 +264,21 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
} }
if ( !C1.IsNull() && !C2.IsNull() ) { if ( !C1.IsNull() && !C2.IsNull() ) {
Handle(BRep_CurveOnClosedSurface) COS = Handle(BRep_CurveOnClosedSurface) COS = new
new BRep_CurveOnClosedSurface(C1,C2,S,L,GeomAbs_C0); BRep_CurveOnClosedSurface(C1,C2,S,L,GeomAbs_C0);
// test if there is already a range Standard_Real aFCur = 0.0, aLCur = 0.0;
if (rangeFound) { COS->Range(aFCur, aLCur);
COS->SetRange(f,l); if (!Precision::IsInfinite(f))
{
aFCur = f;
} }
if (!Precision::IsInfinite(l))
{
aLCur = l;
}
COS->SetRange(aFCur, aLCur);
lcr.Append(COS); lcr.Append(COS);
} }
} }
@ -297,20 +300,13 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr); BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_CurveRepresentation) cr; Handle(BRep_CurveRepresentation) cr;
Handle(BRep_GCurve) GC; Handle(BRep_GCurve) GC;
Standard_Real f = 0.,l = 0.; Standard_Real f = -Precision::Infinite(), l = Precision::Infinite();
Standard_Boolean rangeFound = Standard_False;
while (itcr.More()) { while (itcr.More()) {
GC = Handle(BRep_GCurve)::DownCast(itcr.Value()); GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
if ( !GC.IsNull() ) { if ( !GC.IsNull() ) {
if (GC->IsCurve3D()) { if (GC->IsCurve3D()) {
GC->Range(f,l); GC->Range(f,l);
Standard_Boolean undefined = (Precision::IsPositiveInfinite(l) ||
Precision::IsNegativeInfinite(f));
if (!undefined) {
rangeFound = Standard_True;
}
} }
Standard_Boolean iscos = GC->IsCurveOnSurface(S,L); Standard_Boolean iscos = GC->IsCurveOnSurface(S,L);
if (iscos) break; if (iscos) break;
@ -326,12 +322,21 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
} }
if ( !C1.IsNull() && !C2.IsNull() ) { if ( !C1.IsNull() && !C2.IsNull() ) {
Handle(BRep_CurveOnClosedSurface) COS = Handle(BRep_CurveOnClosedSurface) COS = new
new BRep_CurveOnClosedSurface(C1,C2,S,L,GeomAbs_C0); BRep_CurveOnClosedSurface(C1,C2,S,L,GeomAbs_C0);
// test if there is already a range Standard_Real aFCur = 0.0, aLCur = 0.0;
if (rangeFound) { COS->Range(aFCur, aLCur);
COS->SetRange(f,l); if (!Precision::IsInfinite(f))
{
aFCur = f;
} }
if (!Precision::IsInfinite(l))
{
aLCur = l;
}
COS->SetRange(aFCur, aLCur);
COS->SetUVPoints2(Pf, Pl); COS->SetUVPoints2(Pf, Pl);
lcr.Append(COS); lcr.Append(COS);
} }

View File

@ -0,0 +1,32 @@
puts "======="
puts "OCC28795"
puts "======="
puts ""
##################################################
# Boolean operations corrupt the p-curve of the source planar face if "non-destructive" option is switched off
##################################################
set expected [list {UMin 0.0} {UMax 1.0} {VMin -2e+100} {VMax 0.0}]
box mb -0.5 -0.5 -0.5 1 1 1
explode mb F
prism pryz mb_1 1 0 0 SemiInf
box ab 0 -1 -1 2 2 2
explode ab f
explode pryz f
set bounds [xbounds pryz_1]
# check for expected result
for {set i 0} {$i < 4} {incr i} {
checkreal "[lindex $expected $i 0]" [lindex $bounds $i] [lindex $expected $i 1] 0.0 1.0e-7
}
# Make a simple Boolean operation, e.g. "bsection"
bsection rs ab_2 pryz_1
set bounds [xbounds pryz_1]
# check for expected result
for {set i 0} {$i < 4} {incr i} {
checkreal "[lindex $expected $i 0]" [lindex $bounds $i] [lindex $expected $i 1] 0.0 1.0e-7
}