Help regarding the "spline_B_curve.html" page
Translated by Google Traduction,
from the french version : Help - Info, in french.
The objective of this web page is to compare the curves generated by B-splines with those generated by Math-splines and to show how to switch from one representation to another.
A few decades ago I learned about degree 3 spline functions and wrote programs that use them to pass a curve through given points in a plane.
I've been waiting for such curves to be implemented in software like Inkscape
and FreeCAD for a long time.
I saw at the end of december 2022 on Youtube the excellent video of Freya Holmér
called: "The continuity of Splines"
Unfortunately, the curve that I would call "Math-spline",
based on spline functions and that I implemented in the web page:
is not described by Freya Homér nor used in the software that I know of.
B-splines and Math-splines share several characteristics.
They differ mainly on two characteristics.
Here are the common characteristics:
° of tangents varying continuously along the curve
° of radii of curvature varying continuously along the curve, it is G2
° is easy to calculate, quickly
° can easily be closed
° is invariant under rotation, symmetry and dilation.
Here are the differences.
+ For the B-spline, the influence of the points is only on the 4 neighboring segments of the point.
- For the Math-spline, the influence of the points is practically on the 8 neighboring segments of the point.
Theoretically, the influence is on all segments, but it decreases rapidly (by a factor of 3.73) with distance.
- The B-spline does not pass through any point on the curve, or in some variants only through the first and the last.
+ The Math-spline passes through all the points of the curve.
- The B-spline requires additional control points.
+ The Math-spline does not require any points other than those through which the curve passes.
+ For the Math-spline, it is easy to have breakpoints, so where the tangent varies discontinuously
° You can switch from one control system to another by fairly quick calculations.
The only negative point of a Math-spline is that the influence of the points on the segments is theoretically not local, even if practically it is only done on the 8 neighboring segments of the point.
I started by doing some tests on these Math-splines in :
Explanations of some features of the implementation page
This page is for nothing but testing.
It is used to compare the curves generated by B-splines and those generated by Math-splines.
I would very much like to see the generation of curves by Math-splines in software such as Inkscape
The illustration of generation of a curve passing through given points is done in 2 dimensions, in an 800x800 canvas.
Obviously, we can generalize the way to curves passing through points defined in a 3-dimensional space and even in a space of any dimensions.
Various points can be placed by clicking in the canvas, with the "Shift" key pressed.
To each point of a Math-spline corresponds a point of a B-spline and vice versa.
Just as each Math-spline curve corresponds to a B-spline curve. These two curves are generally superimposed.
The blue points are the control points of the Math-spline. They are on the curve.
Light blue is first, dark blue is last.
They're just controlling, they're not on the curve.
They are introduced to have an exact correspondence with the B-splines, but are not essential, cf "Natural Left" and "Natural Right".
The green dots are the B-spline control points. They are not on the curve.
Light green is first, dark green is last.
By clicking on a point, the point and the corresponding curve are selected.
The selected point can be deleted with the "Delete point" button.
You can add a point before the selected point by clicking and pressing "Ctrl+Shift".
uniform dT = 1 uses a parametrization of the curve giving the same time to go from one point to the next.
distance dependent of Math-spline uses a parametrization of the curve giving a time to pass from one point to the next which is equal to the distance in pixels between the two end points of the segment.
distance dependent of B-spline uses a parametrization of the curve giving a time to pass from one point to the next
which is equal to the distance in pixels between the two points of the B-spline.
Automatic, uses one of the two previous choices, depending of the type of the selected control point.
Closed curve, allows you to close the currently selected curve.
Natural Left, s''(0) = 0, automatically controls the first point of the Math-spline (the light blue one). This is done internally by imposing that the curvature be zero at this point.
Natural Right, s''(end) = 0, automatically controls the last point of the Math-spline (the dark blue one). This is done internally by imposing that the curvature be zero at this point.
Show active spline points, allows to hide or show the points of the active spline.
Show ALL spline points, shows all spline points.
This is useful to be able to make previously masked points visible again.
Broken point (Only for Math-spline), generates a break at the selected point.
In this case, the tangent at this point no longer varies continuously.
These points are, like the first and the last point, characterized by the fact that the second derivative of the components X(t) and Y(t) of the curve have zero second derivative.
Only works with Math-spline. It's not very useful here.
Sound on, allows you to activate or deactivate a sound when you click on a point.
Click to add a spline with .... Points.
This button is used to generate a "Math-spline" curve with the number of points requested.
To test that the generation of "Math-spline" curves works quickly, you can generate a curve containing thousands of points, to see that the calculation and display is done in a fraction of a second.
From about 10,000 points, the calculation is slower and is clearly felt.
You can also use this button to generate curves with only a few points, to compare various curves.
For more information, in particular on mathematics and algorithms, see
French version .pdf and .odt
Version automatically translated into English
.pdf and .docx
with Google Translate.
In this Web page, Youtube videos in french on this subject.
Plan du Site :
Page mise à jour le 21 janvier 2023 par Bernard Gisin
( Envoyer un e-mail )
Hébergement par : www.infomaniak.ch