Fast Automatic Knot Placement Method for Accurate B-spline Curve Fitting☆,☆☆
Graphical abstract
Introduction
Curve fitting using B-splines is a fundamental problem in many applications such as computer-aided design (CAD), geometric modeling, and reverse engineering [1], [2]. High-accuracy fitting is also being explored in data analysis and compression for large scale simulations [3]. The problem of B-spline curve fitting involves finding a B-spline curve that minimizes the least squares error between a sequence of input data points and the fitted spline [4], [5]. In this type of fitting problem, variables include the order of the B-spline, the number of knots, the knot locations, and the control point values.
Often, a uniform knot vector with a predetermined number of knots is used. Fixing the knot vector and optimizing only the control points reduces the B-spline fitting problem to a linear least squares problem. However, using uniform knots may fail to capture details of the input dataset. In contrast, solving for the knot vector in addition to the control points can improve the fitting result dramatically [6], leading to the problem of knot optimization.
Knot optimization consists of finding the placement of as few knots as possible for a B-spline curve that fits some desired approximation error criterion. This is a challenging problem for two reasons. First, the unknown number and locations of knots result in a large and nonlinear optimization problem, which is computationally difficult. Second, analytic expressions for optimal knot locations, or even for general characteristics of optimal knot distributions for a desired error criterion, are not easy to derive [6].
In this work, we use the derivatives of the input data to calculate a feature function that captures the amount and distribution of detail in the data, where higher feature values indicate that a higher knot density is needed to capture the detail and reach the desired approximation error tolerance. Using the cumulative distribution function (CDF) of the feature function, interior knots are distributed, such that higher feature values result in more knots. This approach affords the fitted B-spline more flexibility in those locations, thereby reducing the approximation error. Fig. 1 shows an overview of our knot placement method for an approximation using an order-3 B-spline. Given an input dataset (Fig. 1a) and its third derivative (Fig. 1b), our method calculates a CDF of the feature function (Fig. 1c) using the third derivative. Knot locations, indicated by the black triangles, are determined by a set amount of variation of the feature function (Fig. 1d). The approximation is solved using the resulting knot vector, successfully capturing the detail of the input data points (Fig. 1e).
Our approach works for 1-dimensional input data and parametric curves in 2 or higher dimensions. It is fast and produces high accuracy approximation for a wide range of input data that are smooth and sampled densely enough for high-order derivatives to be estimated from the data. The order of the derivatives depends on the order of the B-spline used for the approximation. The knot placement method works for a B-spline approximation of any order, with the resulting approximation error close to a user-supplied target error.
The remainder of the paper starts with a presentation of related work in Section 2. Section 3 briefly reviews technical details of B-spline approximation. We present our method in Section 4, and compare it with prior work in Section 5. Finally, conclusions are drawn, and future work is discussed in Section 6.
Section snippets
Related work
Knot optimization for B-spline fitting is a well studied topic. Many approaches can be found in the literature. Piegl and Tiller [4] proposed their new knot placement method (NKTP) that places knots with averages of representative parameters forgroups of input points. This leads to a stable system of equations and a uniform distribution of knots along the parameter domain. Liang et al. [7] describe an iterative knot insertion (IKI) method that starts with the fewest knots possible, finds knot
Preliminary
We review the basics of B-spline in this section, and refer interested readers to Farin [31] for more in-depth material.
A B-spline of order is a piecewise polynomial function of order (degree ) with control points, and is defined by where is the B-spline curve at parameter location , are the control points, and are the th order B-spline basis functions defined over the knot vector . We define our B-spline knot vector with
Methodology
Our work is motivated by the idea that an order- B-spline has a piecewise constant th derivative, where derivative discontinuities mark the knot locations, as shown in Fig. 2. Given a set of points sampled from an order- B-spline, one can recover the original B-spline knots by locating the discontinuities in the th derivative. In practice, the input data points will not be sampled from a B-spline, and will not, in general, have distinct discontinuities in their derivatives.
Experimental results
The performance of our knot placement algorithm was tested against six prior works. We implemented each of the other methods in MATLAB.
Table 1 lists the algorithms, their labels used in the comparison plots, and the main idea of each method. “Instant” refers to placing knots without any iterative process. “Iterative” indicates that a repeated adjustment of the knots is done to improve the approximation. “Locally iterative” indicates that, at each iteration, a small local system is solved,
Conclusion and discussion
We introduced a novel knot placement optimization method that analyzes high-order derivatives of the input data, and generates a knot placement such that the resulting least squares fit has low error. We demonstrated our method’s effectiveness by comparing it to a number of state-of-the-art knot placement methods, and showed that our method can achieve comparable or higher approximation accuracy using fewer knots for a range of 1D and parametric datasets. Our method is also computationally
Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Acknowledgments
This work is supported by Advanced Scientific Computing Research, Office of Science, U.S. Department of Energy , under Contract DE-AC02-06CH11357, program manager Laura Biven.
References (34)
- et al.
Reverse engineering of geometric models — An introduction
Comput Aided Des
(1997) - et al.
Parameterization of randomly measured points for least squares fitting of b-spline curves and surfaces
Comput Aided Des
(1995) - et al.
Knot removal for parametric b-spline curves and surfaces
Comput Aided Geom Design
(1987) Least squares splines with free knots: global optimization approach
Appl Math Comput
(2004)- et al.
Knot calculation for spline fitting via sparse optimization
Comput Aided Des
(2015) - et al.
Learnt knot placement in b-spline curve approximation using support vector machines
Comput Aided Geom Design
(2018) - et al.
Evolutionary computation for optimal knots allocation in smoothing splines
Appl Math Model
(2013) - et al.
Elitist clonal selection algorithm for optimal choice of free knots in b-spline data fitting
Appl Soft Comput
(2015) - et al.
B-spline curve fitting based on adaptive curve refinement using dominant points
Comput Aided Des
(2007) - et al.
Adaptive knot placement in b-spline curve approximation
Comput Aided Des
(2005)
Real-time nurbs interpolation using fpga for high speed motion control
Comput Aided Des
Fundamentals of computer aided geometric design
Foundations of multivariate functional approximation for scientific data
The NURBS book
Approximation to data by splines with free knots
SIAM J Numer Anal
A novel knot selection method for the error-bounded b-spline curve fitting of sampling points in the measuring process
Meas Sci Technol
A direct method to solve optimal knots of b-spline curves: An application for non-uniform b-spline curves fitting
PLoS One
Cited by (29)
Nonparametric density estimation with nonuniform B-spline bases
2024, Journal of Computational and Applied MathematicsFourier-informed knot placement schemes for B-spline approximation
2023, Mathematics and Computers in SimulationA residuals-distribution-guided local optimization approach to B-spline fitting in capturing image outlines
2023, Computers and Graphics (Pergamon)Geometrically designed variable knot splines in generalized (non-)linear models
2023, Applied Mathematics and ComputationCitation Excerpt :Such non-linear models have been considered in the Normal case by e.g. [24] but the direct ML estimation of the knot locations requires non-linear least squares optimization, which is often computationally prohibitive with corresponding complications and limitations (due to e.g. multiple extrema, knot confounding or lethargy problems; cf. Beliakov [2], Jupp [17], Zhou and Shen [40] and Kovács and Fekete [21]). Alternative data driven procedures to estimate the knot positions have been proposed by many authors in the Normal case (see e.g. [30,39]). A brief review of the related literature on Normal free-knot spline regression is provided by Kaishev et al. [18].
Data approximation by L<sup>1</sup> spline fits with free knots
2022, Computer Aided Geometric DesignCitation Excerpt :Laube et al. (2018) develop support vector machine method which considers multiple features including curvature, angle and distance to neighbors. Yeh et al. (2020) select the knots by evenly distributing the “geometric feature contents” based on estimated derivatives of a certain order. The limitation of this strategy is that knots must be data points and not completely free.
- ☆
This paper has been recommended for acceptance by J. Peters.
- ☆☆
This research project is funded by the U.S. Department of Energy, under Contract DE-AC02-06CH11357.