BSplineCurve

BSplineCurve[{pt1,pt2,}]

is a graphics primitive that represents a nonuniform rational B-spline curve with control points pti.

Details and Options

  • BSplineCurve is also known as basis spline curve or nonuniform rational B-spline (NURBS) curve.
  • BSplineCurve can be used in both Graphics and Graphics3D (two and threedimensional graphics).
  • The positions of control points can be specified either in ordinary coordinates as {x,y} or {x,y,z}, or in scaled coordinates as Scaled[{x,y}] or Scaled[{x,y,z}].
  • In two dimensions, Offset and ImageScaled can be used to specify coordinates.
  • The following options can be given:
  • SplineDegreeAutomaticdegree of polynomial basis
    SplineKnotsAutomaticknot sequence for spline
    SplineWeightsAutomaticcontrol point weights
    SplineClosedFalsewhether to make the spline closed
  • By default, BSplineCurve uses cubic splines.
  • The option setting SplineDegree->d specifies that the underlying polynomial basis should have maximal degree d.
  • By default, knots are chosen uniformly in parameter space, with additional knots added so that the curve starts at the first control point and ends at the last one.
  • With an explicit setting for SplineKnots, the degree of the polynomial basis is determined from the number of knots specified and the number of control points.
  • With the default setting SplineWeights->Automatic, all control points are chosen to have equal weights, corresponding to a polynomial B-spline curve.
  • Curve thickness can be specified using Thickness or AbsoluteThickness, as well as Thick and Thin.
  • Curve dashing can be specified using Dashing or AbsoluteDashing, as well as Dashed, Dotted, etc.
  • Curve shading or coloring can be specified using CMYKColor, GrayLevel, Hue, Opacity, or RGBColor.
  • Individual coordinates and lists of coordinates in BSplineCurve can be Dynamic objects.

Examples

open allclose all

Basic Examples  (1)

A B-spline curve and its control points in 2D:

A B-spline curve and its control points in 3D:

Scope  (12)

Curve Specification  (5)

A cubic B-spline curve:

B-spline curves with the same control points and different degrees:

By default, a B-spline curve is open:

A closed B-spline curve automatically adds the first control point at the end:

Knots can be explicitly specified to control the smoothness of a curve:

Weights can be specified to each point:

Curve Styling  (4)

B-spline curves with different thicknesses:

Thickness in scaled size:

Thickness in printer's points:

Dashed curves:

Colored curves:

Coordinate Specification  (3)

Use Scaled coordinates:

Use ImageScaled coordinates in 2D:

Use Offset coordinates in 2D:

Generalizations & Extensions  (4)

Knot Sequence  (3)

By default, knots are generated in such a way that the curve is smooth overall:

By repeating knots, you can decrease the smoothness of the curve:

"Unclamped" generates uniform knots, and the curve will not go through the endpoints:

Unclamped knots combined with SplineClosed will make a uniform periodic B-spline curve:

Control Point Weights  (1)

By default, all the control points have equal weights:

By giving more weight to a control point, the curve will be attracted to that point:

Applications  (5)

Glyphs and Shapes  (1)

By using weights, you can make a rational B-spline, such as a circle:

Interpolation  (2)

Choose six points to be interpolated:

Compute distances between control points:

Compute normalized parameters wrt the distances (chord length parametrization):

A cubic B-spline curve with clamped knots will be used:

Set up the square basis matrix to solve:

Solve the linear system to get control points:

Show the interpolating curve with the original data:

Choose 3D points to be interpolated:

Compute distances between control points:

Compute normalized parameters wrt the distances (chord length parametrization):

A cubic B-spline curve with clamped knots will be used:

Set up the square basis matrix to solve:

Solve the linear system to get control points:

Show the interpolating curve with the original data:

Least Square Fitting  (1)

Sample a list of points to be approximated with random noise:

Use uniform parametrization:

Define a function to generate clamped knots for a given number of control points and degrees:

Define the basis matrix for least squares:

A cubic B-spline curve with 12 control points will be used for fitting:

Show the data with the curve:

The results with various numbers of control points:

The results with 12 control points and different degrees:

Geometric Invariances  (1)

Linear transition from one B-spline curve to another:

Properties & Relations  (6)

A B-spline curve with degree 1 is equivalent to a line:

A B-spline curve is affine invariant:

A B-spline curve lies in the union of convex hulls of subsets of control points:

In 3D, a B-spline curve with planar control points lies in the plane:

BSplineBasis can be used to build up B-spline curve objects:

The individual basis functions have bounded support:

Changing the knots affects the basis functions just as it does the BSplineCurve:

A B-spline curve generated from the average of two sets of control points:

The new curve is the average of two B-spline curves:

Wolfram Research (2008), BSplineCurve, Wolfram Language function, https://reference.wolfram.com/language/ref/BSplineCurve.html.

Text

Wolfram Research (2008), BSplineCurve, Wolfram Language function, https://reference.wolfram.com/language/ref/BSplineCurve.html.

CMS

Wolfram Language. 2008. "BSplineCurve." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BSplineCurve.html.

APA

Wolfram Language. (2008). BSplineCurve. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BSplineCurve.html

BibTeX

@misc{reference.wolfram_2024_bsplinecurve, author="Wolfram Research", title="{BSplineCurve}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/BSplineCurve.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_bsplinecurve, organization={Wolfram Research}, title={BSplineCurve}, year={2008}, url={https://reference.wolfram.com/language/ref/BSplineCurve.html}, note=[Accessed: 21-November-2024 ]}