mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030645: Modeling Algorithms - B-spline segmentation produces wrong parametrization
Method Segment() of B-spline curve and surface has been extended by parameter theTolerance (theUTolerance and theVTolerance for surface), which defines the proximity between knots of a NURBS and boundaries of cutting segment. The default value of the tolerance is Precision::PConfusion(). Test cases have been added to check segmenting of B-spline surface and curves both 2D and 3D.
This commit is contained in:
@@ -1131,7 +1131,7 @@ static Standard_Integer value2d (Draw_Interpretor& ,
|
||||
|
||||
static Standard_Integer segment (Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 4) return 1;
|
||||
if (n < 4 || n > 5) return 1;
|
||||
|
||||
Handle(Geom_BezierCurve) GBz = DrawTrSurf::GetBezierCurve(a[1]);
|
||||
Handle(Geom_BSplineCurve) GBs = DrawTrSurf::GetBSplineCurve(a[1]);
|
||||
@@ -1140,14 +1140,18 @@ static Standard_Integer segment (Draw_Interpretor& , Standard_Integer n, const c
|
||||
|
||||
Standard_Real f = Draw::Atof(a[2]), l = Draw::Atof(a[3]);
|
||||
|
||||
Standard_Real aTolerance = Precision::PConfusion();
|
||||
if (n == 5)
|
||||
aTolerance = Draw::Atof(a[4]);
|
||||
|
||||
if (!GBz.IsNull())
|
||||
GBz->Segment(f,l);
|
||||
else if (!GBs.IsNull())
|
||||
GBs->Segment(f,l);
|
||||
GBs->Segment(f, l, aTolerance);
|
||||
else if (!GBz2d.IsNull())
|
||||
GBz2d->Segment(f,l);
|
||||
else if (!GBs2d.IsNull())
|
||||
GBs2d->Segment(f,l);
|
||||
GBs2d->Segment(f, l, aTolerance);
|
||||
else
|
||||
return 1;
|
||||
|
||||
@@ -2135,7 +2139,7 @@ void GeomliteTest::CurveCommands(Draw_Interpretor& theCommands)
|
||||
csetperiodic,g);
|
||||
|
||||
theCommands.Add("segment",
|
||||
"segment name Ufirst Ulast",
|
||||
"segment name Ufirst Ulast [tol]",
|
||||
__FILE__,
|
||||
segment , g);
|
||||
|
||||
|
@@ -1351,7 +1351,7 @@ static Standard_Integer exchuv (Draw_Interpretor& , Standard_Integer n, const ch
|
||||
|
||||
static Standard_Integer segsur (Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 6) return 1;
|
||||
if (n < 6 || n > 8) return 1;
|
||||
|
||||
Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]);
|
||||
Handle(Geom_BSplineSurface) GBs;
|
||||
@@ -1359,7 +1359,15 @@ static Standard_Integer segsur (Draw_Interpretor& , Standard_Integer n, const ch
|
||||
GBs = DrawTrSurf::GetBSplineSurface(a[1]);
|
||||
if (GBs.IsNull())
|
||||
return 1;
|
||||
GBs->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
|
||||
|
||||
Standard_Real aUTolerance = Precision::PConfusion();
|
||||
Standard_Real aVTolerance = Precision::PConfusion();
|
||||
if (n >= 7)
|
||||
aUTolerance = aVTolerance = Draw::Atof(a[6]);
|
||||
if (n == 8)
|
||||
aVTolerance = Draw::Atof(a[7]);
|
||||
|
||||
GBs->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]), aUTolerance, aVTolerance);
|
||||
}
|
||||
else {
|
||||
GBz->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]));
|
||||
@@ -1770,7 +1778,7 @@ void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands)
|
||||
exchuv,g);
|
||||
|
||||
theCommands.Add("segsur",
|
||||
"segsur name Ufirst Ulast Vfirst Vlast",
|
||||
"segsur name Ufirst Ulast Vfirst Vlast [Utol [Vtol]]",
|
||||
__FILE__,
|
||||
segsur , g);
|
||||
|
||||
|
Reference in New Issue
Block a user