1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030094: Modeling Algorithms - Defeaturing does not work on the attached shape due to incorrect extension of the torus

BRepLib::ExtendFace method when working with analytical and periodic faces now takes into account the possible closeness of the result face.
Test cases for the issue.
This commit is contained in:
emv
2018-08-31 10:17:47 +03:00
committed by bugmaster
parent 83f7dbeb62
commit 82d3cd0b0a
3 changed files with 85 additions and 6 deletions

View File

@@ -2706,18 +2706,23 @@ void BRepLib::ExtendFace(const TopoDS_Face& theF,
Standard_Real aSUMin, aSUMax, aSVMin, aSVMax;
aSurf->Bounds(aSUMin, aSUMax, aSVMin, aSVMax);
if (aBAS.IsUPeriodic())
Standard_Boolean isUPeriodic = aBAS.IsUPeriodic();
Standard_Real anUPeriod = isUPeriodic ? aBAS.UPeriod() : 0.0;
if (isUPeriodic)
{
// Adjust face bounds to first period
Standard_Real aDelta = aFUMax - aFUMin;
aFUMin = Max(aSUMin, aFUMin + aBAS.UPeriod()*Ceiling((aSUMin - aFUMin)/aBAS.UPeriod()));
aFUMin = Max(aSUMin, aFUMin + anUPeriod*Ceiling((aSUMin - aFUMin) / anUPeriod));
aFUMax = aFUMin + aDelta;
}
if (aBAS.IsVPeriodic())
Standard_Boolean isVPeriodic = aBAS.IsVPeriodic();
Standard_Real aVPeriod = isVPeriodic ? aBAS.VPeriod() : 0.0;
if (isVPeriodic)
{
// Adjust face bounds to first period
Standard_Real aDelta = aFVMax - aFVMin;
aFVMin = Max(aSVMin, aFVMin + aBAS.VPeriod()*Ceiling((aSVMin - aFVMin)/aBAS.VPeriod()));
aFVMin = Max(aSVMin, aFVMin + aVPeriod*Ceiling((aSVMin - aFVMin) / aVPeriod));
aFVMax = aFVMin + aDelta;
}
@@ -2729,9 +2734,23 @@ void BRepLib::ExtendFace(const TopoDS_Face& theF,
aVRes = aBAS.VResolution(theExtVal);
if (theExtUMin) aFUMin = Max(aSUMin, aFUMin - anURes);
if (theExtUMax) aFUMax = Min(aSUMax, aFUMax + anURes);
if (theExtUMax) aFUMax = Min(isUPeriodic ? aFUMin + anUPeriod : aSUMax, aFUMax + anURes);
if (theExtVMin) aFVMin = Max(aSVMin, aFVMin - aVRes);
if (theExtVMax) aFVMax = Min(aSVMax, aFVMax + aVRes);
if (theExtVMax) aFVMax = Min(isVPeriodic ? aFVMin + aVPeriod : aSVMax, aFVMax + aVRes);
// Check if the periodic surface should become closed.
// In this case, use the basis surface with basis bounds.
const Standard_Real anEps = Precision::PConfusion();
if (isUPeriodic && Abs(aFUMax - aFUMin - anUPeriod) < anEps)
{
aFUMin = aSUMin;
aFUMax = aSUMax;
}
if (isVPeriodic && Abs(aFVMax - aFVMin - aVPeriod) < anEps)
{
aFVMin = aSVMin;
aFVMax = aSVMax;
}
aS = aSurf;
}