Topics in Geometric Modeling Project | ||||||||||||||||
Polynomial Fitting | ||||||||||||||||
Author: Ives José de Albuquerque Macêdo Júnior | ||||||||||||||||
|
||||||||||||||||
We designed an API to automatically fit a polynomial from a finite set of samples. After specifying a basis to the finite-dimensional linear space (over the field of real numbers) of n-dimensional polynomials with degree less than, or equal to, a non-negative integer d, we are able to both: fit (point,value)-pairs and fit the zero-set of a polynomial from a given set of points. In both applications, weights may be assigned (both to samples and to the elements in the basis) to bias the fitting process.
The polyfit library was designed to be of simple use and easy to extend. For simplicity, the user just needs to provide enough data to perform the desired fitting (e.g. basis, samples etc.) by instancing a few classes and calling other few methods. The design is based on the main concepts involved in the fitting process: the specification of an arbitrary basis to a finite-dimensional function space and the evaluation of the fitted polynomial. This is the rationale which motivated our architecture (below follows a simplified class diagram containing the public interface avaliable to the user):
To use the polyfit library, the user just needs to include the main header For a more detailed description of the parameters in the above classes and their methods and how to provide them, we refer the reader to polyfit's API documentation, to the demo program in the source code and to the examples in the following section.
Observations:
g++ -Wall -O2 -o polyfit polyfit.cpp -I../include -lclapack_netlib -lcblaswr -lcblas -latlas -lF77 -lI77 -lm 2. For numerical stability reasons, we do not recommend the use of MonomialBasis in calculations involving large dimensions and large polynomial degrees, i.e. if you really need to work with high-order polynomials in large dimensions, you should extend the library with a better behaved polynomial basis. 3. The fitting of zero-sets by the implemented method is an unstable problem and, therefore, its use in noisy point clouds (with moderate-order polynomials) is prone to errors. Although some works try to overcome these problems using more information about the desired fit (e.g. tangents and normals), we only implemented the basic (unstable) method. For more information on these methods, see [6] and references cited therein.
ToDo List:
Below, we provide simple examples of the two main fitting procedures available through the polyfit library.
Next we show some results of applying the polynomial fitting process to approximate a halftone image.
Source Code: [gzipped tar archive - 25K] (use it by your own risk... :D) Documentation (generated by Doxygen): [HTML] [HTML tarball - 327K] [PDF file - 726K]
References:
|
||||||||||||||||
|
||||||||||||||||
Instituto Nacional de Matemática Pura e Aplicada - IMPA | ||||||||||||||||
Vision and Graphics Laboratory - Visgraf | ||||||||||||||||
GNU General Public License |