![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Constrained least-squares B-spline curve approximation with exact interpolation constraints. More...
#include <Approx_BSplineApproxInterp.hxx>
Public Member Functions | |
| Approx_BSplineApproxInterp (const NCollection_Array1< gp_Pnt > &thePoints, int theNbControlPts, int theDegree=3, bool theContinuousIfClosed=false) | |
| Creates a constrained approximation solver. | |
| void | InterpolatePoint (int thePointIndex, bool theWithKink=false) |
| Marks a point to be exactly interpolated rather than approximated. | |
| void | Perform () |
| Performs the fit using automatically computed parameters. Parameters are computed from input points using current parametrization alpha. | |
| void | Perform (const NCollection_Array1< double > &theParams) |
| Performs the fit with given parameters. | |
| void | PerformOptimal (int theMaxIter) |
| Performs the fit with iterative parameter optimization using automatically computed initial parameters. | |
| void | PerformOptimal (const NCollection_Array1< double > &theParams, int theMaxIter) |
| Performs the fit with iterative parameter optimization. Parameters of approximated points are re-projected onto the curve after each iteration to improve the fit. | |
| bool | IsDone () const |
| Returns true if the fit was successfully computed. | |
| const occ::handle< Geom_BSplineCurve > & | Curve () const |
| Returns the resulting B-spline curve. | |
| double | MaxError () const |
| Returns the maximum approximation error (distance at approximated points). | |
| void | SetParametrizationAlpha (double theAlpha) |
| Sets the parametrization power for automatic parameter computation. 0.0 = uniform, 0.5 = centripetal (default), 1.0 = chord-length. | |
| void | SetMinPivot (double theMinPivot) |
| Sets the minimum pivot value for the Gauss solver. Matrices with pivots below this threshold are treated as singular. | |
| void | SetClosedTolerance (double theRelTol) |
| Sets the relative tolerance for detecting closed curves. Closedness is detected when first/last points are within theRelTol * (bounding box diagonal). | |
| void | SetKnotInsertionTolerance (double theTol) |
| Sets the tolerance for detecting duplicate knot positions during insertion. | |
| void | SetConvergenceTolerance (double theTol) |
| Sets the convergence tolerance for parameter optimization. Optimization stops when relative error reduction falls below this value. | |
| void | SetProjectionTolerance (double theTol) |
| Sets the tolerance for point projection onto curve during optimization. | |
Constrained least-squares B-spline curve approximation with exact interpolation constraints.
This class fits a B-spline curve through a set of 3D points, where each point can be either approximated (in the least-squares sense) or exactly interpolated. Selected interpolation points can additionally be marked as "kinks" - the solver then inserts high-multiplicity knots at the corresponding parameters to preserve C0 discontinuities.
The algorithm solves a KKT (Karush-Kuhn-Tucker) saddle-point system:
where:
Usage:
| Approx_BSplineApproxInterp::Approx_BSplineApproxInterp | ( | const NCollection_Array1< gp_Pnt > & | thePoints, |
| int | theNbControlPts, | ||
| int | theDegree = 3, | ||
| bool | theContinuousIfClosed = false ) |
Creates a constrained approximation solver.
| [in] | thePoints | array of 3D points to fit (1-based indexing) |
| [in] | theNbControlPts | desired number of control points for the B-spline |
| [in] | theDegree | degree of the B-spline (default 3) |
| [in] | theContinuousIfClosed | if true, enforces C2 continuity for closed curves |
| const occ::handle< Geom_BSplineCurve > & Approx_BSplineApproxInterp::Curve | ( | ) | const |
Returns the resulting B-spline curve.
Marks a point to be exactly interpolated rather than approximated.
| [in] | thePointIndex | 0-based index of the point |
| [in] | theWithKink | if true, a kink (C0 break) is inserted at this parameter |
|
inline |
Returns true if the fit was successfully computed.
|
inline |
Returns the maximum approximation error (distance at approximated points).
| void Approx_BSplineApproxInterp::Perform | ( | ) |
Performs the fit using automatically computed parameters. Parameters are computed from input points using current parametrization alpha.
| void Approx_BSplineApproxInterp::Perform | ( | const NCollection_Array1< double > & | theParams | ) |
Performs the fit with given parameters.
| [in] | theParams | parameter values for each point (size must match point count) |
| void Approx_BSplineApproxInterp::PerformOptimal | ( | const NCollection_Array1< double > & | theParams, |
| int | theMaxIter ) |
Performs the fit with iterative parameter optimization. Parameters of approximated points are re-projected onto the curve after each iteration to improve the fit.
| [in] | theParams | initial parameter values |
| [in] | theMaxIter | maximum number of optimization iterations |
Performs the fit with iterative parameter optimization using automatically computed initial parameters.
| [in] | theMaxIter | maximum number of optimization iterations |
Sets the relative tolerance for detecting closed curves. Closedness is detected when first/last points are within theRelTol * (bounding box diagonal).
| [in] | theRelTol | relative tolerance (default 1e-12) |
Sets the convergence tolerance for parameter optimization. Optimization stops when relative error reduction falls below this value.
| [in] | theTol | convergence tolerance (default 1e-3) |
Sets the tolerance for detecting duplicate knot positions during insertion.
| [in] | theTol | knot matching tolerance (default 1e-4) |
Sets the minimum pivot value for the Gauss solver. Matrices with pivots below this threshold are treated as singular.
| [in] | theMinPivot | minimum pivot threshold (default 1e-20) |
Sets the tolerance for point projection onto curve during optimization.
| [in] | theTol | projection accuracy (default 1e-6) |