1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-26 10:19:45 +03:00

Modeling - Periodic BSpline curve bounding #493

Enhance periodic curve handling in BndLib_Add3dCurve::Add method.
Checks the periodic BSpline on 3 directions of period for tolerance upgrade.
This commit is contained in:
Pasukhin Dmitry 2025-04-11 22:08:02 +01:00 committed by GitHub
parent 7c8a432c8e
commit 15ec314a87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 5 deletions

View File

@ -215,12 +215,33 @@ void BndLib_Add3dCurve::Add(const Adaptor3d_Curve& C,
u2 = Bsaux->LastParameter();
// modified by NIZHNY-EAP Fri Dec 3 14:29:18 1999 ___END___
}
const Standard_Real anU2Periodic =
Bsaux->IsPeriodic() ? (u2 - (Bsaux->LastParameter() - Bsaux->FirstParameter())) : u2;
Standard_Real aSegmentTol = 2. * Precision::PConfusion();
if (Abs((anU2Periodic - u1) < aSegmentTol))
// For periodic curves, check if parameters are close in either direction
if (Bsaux->IsPeriodic())
{
aSegmentTol = Abs(anU2Periodic - u1) * 0.01;
const Standard_Real aPeriod = Bsaux->LastParameter() - Bsaux->FirstParameter();
// Check direct distance between parameters
const Standard_Real aDirectDiff = Abs(u2 - u1);
// Check distances across period boundary (in both directions)
const Standard_Real aCrossPeriodDiff1 = Abs(u2 - aPeriod - u1);
const Standard_Real aCrossPeriodDiff2 = Abs(u1 - aPeriod - u2);
// Find the minimum difference (closest approach)
const Standard_Real aMinDiff =
Min(aDirectDiff, Min(aCrossPeriodDiff1, aCrossPeriodDiff2));
if (aMinDiff < aSegmentTol)
{
aSegmentTol = aMinDiff * 0.01;
}
}
// For non-periodic curves, just check direct parameter difference
else if (Abs(u2 - u1) < aSegmentTol)
{
aSegmentTol = Abs(u2 - u1) * 0.01;
}
Bsaux->Segment(u1, u2, aSegmentTol);
Bs = Bsaux;

View File

@ -20,6 +20,6 @@ bop f1 f2
bopsection result
checkprops result -l 13.7747
checknbshapes result -vertex 3 -edge 2
checknbshapes result -vertex 4 -edge 3
checkview -screenshot -2d -path ${imagedir}/${test_image}.png