Example 8. Let use
Mathematica's Bézier curve fit procedure.
The following example is found in
the "Help" menu
under Add-ons; Standard
Packages; NumericalMath; SplineFit.
Find the "spline fit" through (0,0), (1,2), (-1,3), (0,1),
(3,0).
Solution 8.
This command loads the package.
This generates a cubic spline from pts.
Note. Four splines are required, so the parameterization is chosen to be the interval [0,4].
Here is a graph of the curve.
![[Graphics:../Images/BezierCurveMod_gr_238.gif]](../Images/BezierCurveMod_gr_238.gif)
Here is the internal form of the cubic spline function generated from pts.
SplineFunction[Cubic, {0., 4.}, {{0, 0}, {1, 2}, {-1, 3}, {0, 1}, {3, 0}}, {{{0, 111/56, 0, -55/56}, {0, 57/28, 0, -1/28}},![]()
{{1, -27/28, -165/56, 107/56}, {2, 27/14, -3/28, -23/28}}, {{-1, -9/8, 39/14, -37/56}, {3, -3/4, -18/7, 37/28}},
{{0, 69/28, 45/56, -15/56}, {1, -27/14, 39/28, -13/28}}}]
Observe, that Mathematica returns a list of four vectors, each of which contains two four element list, just right number of coefficients for forming eight cubic equations.
By luck, they are in "standard form" and we can use the coefficient vectors; change some commas to + signs; fill in the powers of t necessary to form the cubics.
![[Graphics:../Images/BezierCurveMod_gr_245.gif]](../Images/BezierCurveMod_gr_245.gif)
Are the two constructions the same ?
![[Graphics:../Images/BezierCurveMod_gr_246.gif]](../Images/BezierCurveMod_gr_246.gif)
![[Graphics:../Images/BezierCurveMod_gr_247.gif]](../Images/BezierCurveMod_gr_247.gif)
(c) John H. Mathews 2004