/spline-curve-fitting

B-Spline, Bezier, and Linear/Non-Linear fitting (Approximation and Interpolation) algorithms are implemented in Javascript.

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Spline Curve Fitting

This project provide you with several curve fitting methods. Moreover, for each method you can visually observe the error. The implemented curve fitting methods are as follows. Each of the methods support specific parameters for Approximation and Interpolation which give you a flexibility in shaping the curve you desire.

💘 For implementing B-Spline and Bezier curves, I exactly followed Dr. Shene's notes which seems to be the best available resource on this matter.

B-Spline Interpolation and Approximation

For B-Spline you can select from several knot and Parameter selection algorithms and you are free to choose the number of control points. Even you are able to find the curve with least error using Error Limit Settings. In addition, you need to provide the panel with an input file containing your points. This file must be in a form of a JSON or a white-space seperated file.

You even can draw spline by providing Control Points. In this case you need to choose a file which contains the control points, knots, and the order.

Bezier Interpolation and Approximation

For drawing a Bezier curve you need to provide an input [file] containing Control Points.

Piecewise Approximation

Using piecewise approximation you can approximate your data using several functions at the same time. In fact, in this approach you need to segment your data points and determine the approximation function to approximate that segment. Then, we approximate that segment using the determined function. In this approach, we connect two consecutive curves using a 3rd Order polynomial to smoothen the whole curve.

You can select following functions as segment approximator.

  1. Linear Reciprocal
  2. Non-Linear Reciprocal
  3. Non-Linear Exponential
  4. Non-Linear Gaussian
  5. Non-Linear SQRT
  6. Chebyshev Polynomials First Kind
  7. Chebyshev Polynomials Second Kind
  8. Bessel Polynomials
  9. Legendre Polynomials
  10. Laguerre Polynomials
  11. Monomial Polynomials

You need to provide the panel with an input file containing your points. This file must be in a form of a JSON or a white-space seperated file. You need define your segment by modifying the SegmentsDefiner file.

Usage

You just need to download the project and then open the index.hmlt page using a modern Web Browser such as Google Chrome.