CurveFitting
BSplineCurve
compute a B-spline curve
Calling Sequence
Parameters
Description
Examples
BSplineCurve(xydata, v, opts)
BSplineCurve(xdata, ydata, v, opts)
xydata
-
list, Array, DataFrame, or Matrix of the form [[x1,y1], [x2,y2], ... , [xn,yn]]; data points
xdata
list, Array, DataSeries, or Vector of the form [x1, x2, ..., xn]; independent values
ydata
list, Array, DataSeries, or Vector or the form [y1, y2, ..., yn]; dependent values
v
name
opts
(optional) one or more equations of the form order=k or knots=knotlist
The BSplineCurve routine computes a B-spline curve based on the control points {x1,y1,x2,y2,...,xn,yn}. The resulting curve is in parametric form xf⁡v,yf⁡v,v=a..b, where xf⁡v and yf⁡v are piecewise functions of v, and a..b is the range over which the B-spline curve is defined.
The BSplineCurve routine can be called in two ways.
The first form accepts a list, Array, or Matrix, [[x1,y1],[x2,y2],...,[xn,yn]], of data points.
The second form accepts the input data as two lists, two Arrays, or two Vectors. In this form, the first set of data contains the independent values, [x1,x2,...,xn], and the second set of data contains the dependent values, [y1,y2,...,yn]. Each element must be of type algebraic.
A cubic (order 4) B-spline curve is produced, unless the order=k (where 0<k<=n+1 ) option is provided. An order k B-spline curve has polynomial pieces of degree less than k.
A uniform knot list is used by the procedure, but a different knot list can be specified using the knots=knotlist option. The list knotlist must contain exactly n+k values. These values must be in nondecreasing order; otherwise, unexpected results may be produced. If the knots=knotlist option is the only option provided, then an order 4 B-spline is assumed. Knots can have a multiplicity up to k−1. If the multiplicity of a knot is m, then the continuity at that knot is C⁡k−m−1.
The B-spline curve is defined only on the range v=knotlistk...knotlistn+1. For any value of v in this range, all k blending functions are present in the B-spline curve. These blending functions are computed by the CurveFitting[BSpline] procedure.
This function is part of the CurveFitting package, and so it can be used in the form BSplineCurve(..) only after executing the command with(CurveFitting). However, it can always be accessed through the long form of the command by using CurveFitting[BSplineCurve](..).
The following example produces a cubic (order 4) B-spline curve using a uniform knot list.
with⁡CurveFitting:
xydata≔0,0,1,1,4,9,6,10,8,5,8,3
c1≔BSplineCurve⁡xydata,v
c1≔0v<1v−136v<2−56+v2+v−222+v−236v<3−143+v−32−v−332+2⁢vv<4−376+5⁢v2−v−422+v−436v<5−4+2⁢v−v−533v<653+v−v−62−v−63v<71043−4⁢v−4⁢v−72+8⁢v−733v<81003−4⁢v+4⁢v−82−4⁢v−833v<909≤v,0v<1v−136v<2−56+v2+v−222+v−23v<3−343+7⁢v−322−7⁢v−333+9⁢v2v<4−616+9⁢v2−7⁢v−422+v−436v<519−2⁢v−3⁢v−52+3⁢v−532v<6532−7⁢v2+3⁢v−622−2⁢v−633v<7613−5⁢v2−v−722+2⁢v−733v<8252−3⁢v2+3⁢v−822−v−832v<909≤v,v=3..6
Use the plot command to see the resulting curve on the defined range, along with the boundary defined by the input points.
plot⁡c1,xydata
The next example produces a quadratic (order 3) B-spline from the same input points, but with multiply-defined knot values.
c2≔BSplineCurve⁡xydata,v,order=3,knots=0,0,1,2,3,3,4,5,6
c2≔0v<0v22v<1−12+v+v−12v<2−72+3⁢v+v−222v<3−6+4⁢v−2⁢v−32v<48−4⁢v−42v<544−8⁢v+4⁢v−52v<606≤v,0v<0v22v<1−12+v+7⁢v−122v<2−11+8⁢v−3⁢v−22v<340−10⁢v+4⁢v−32v<412−2⁢v−v−422v<5332−3⁢v+3⁢v−522v<606≤v,v=1..4
plot⁡c2,xydata
See Also
CurveFitting[BSpline]
plot
type/algebraic
Download Help Document