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:
@@ -650,13 +650,14 @@ Standard_Real Geom2d_BSplineCurve::ReversedParameter( const Standard_Real U) con
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Geom2d_BSplineCurve::Segment(const Standard_Real aU1,
|
||||
const Standard_Real aU2)
|
||||
const Standard_Real aU2,
|
||||
const Standard_Real theTolerance)
|
||||
{
|
||||
if (aU2 < aU1)
|
||||
throw Standard_DomainError("Geom2d_BSplineCurve::Segment");
|
||||
//
|
||||
Standard_Real AbsUMax = Max(Abs(FirstParameter()),Abs(LastParameter()));
|
||||
Standard_Real Eps = Max (Epsilon(AbsUMax), Precision::PConfusion());
|
||||
Standard_Real Eps = Max (Epsilon(AbsUMax), theTolerance);
|
||||
Standard_Real NewU1, NewU2;
|
||||
Standard_Real U, DU=0;
|
||||
Standard_Integer i, k, index;
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <GeomAbs_BSplKnotDistribution.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
@@ -356,6 +357,10 @@ public:
|
||||
//! All data structure tables of this BSpline curve are
|
||||
//! modified, but the knots located between U1 and U2
|
||||
//! are retained. The degree of the curve is not modified.
|
||||
//!
|
||||
//! Parameter theTolerance defines the possible proximity of the segment
|
||||
//! boundaries and B-spline knots to treat them as equal.
|
||||
//!
|
||||
//! Warnings :
|
||||
//! Even if <me> is not closed it can become closed after the
|
||||
//! segmentation for example if U1 or U2 are out of the bounds
|
||||
@@ -369,7 +374,8 @@ public:
|
||||
//! raises if U2 < U1.
|
||||
//! Standard_DomainError if U2 - U1 exceeds the period for periodic curves.
|
||||
//! i.e. ((U2 - U1) - Period) > Precision::PConfusion().
|
||||
Standard_EXPORT void Segment (const Standard_Real U1, const Standard_Real U2);
|
||||
Standard_EXPORT void Segment (const Standard_Real U1, const Standard_Real U2,
|
||||
const Standard_Real theTolerance = Precision::PConfusion());
|
||||
|
||||
//! Modifies this BSpline curve by assigning the value K
|
||||
//! to the knot of index Index in the knots table. This is a
|
||||
|
Reference in New Issue
Block a user