The Wolfram Language provides fully integrated spline graphics primitives, such as Bézier curves, B-spline curves, and B-spline surfaces. The spline primitives support a full range of user controls, such as arbitrary degree and a rational form of splines. The spline primitives provide an easy way to create complex graphics.
BezierCurve draws a composite Bézier curve that is defined by the given control points. By default, a cubic Bézier curve is used:
The SplineDegree option controls the underlying polynomial degrees of the spline curves. Usually, the higher the degree, the smoother the resulting curve.
The SplineKnots option provides detailed control over the shape of a B-spline curve. Without specifying values for SplineKnots, the Wolfram Language gives the default knot sequence in such a way that the resulting curve is smooth overall and the endpoints are interpolated:
This is the same curve, but with the default knot values explicitly shown. The first and the last repeating knots make the curve go through the endpoints, where is the spline degree. The rest of the knots are uniformly distributed:
The SplineWeights option can be used to assign weights to each point. The curve will be pulled toward the points with larger weights:
With no explicit setting for SplineWeights, the Wolfram Language assigns equal weights to each point:
Notice that the curve is pulled towards the middle point, which is given a weight of 5 with SplineWeights:
Mathematically, non-uniform weights create rational B-spline functions, also known as NURBS. NURBS can represent shapes that regular B-splines cannot. For instance, use BSplineCurve to create an exact circle by setting SplineWeights to the values in and SplineKnots to the values in :
By wrapping curves with Tube, you can create tubed spline curves in 3D. Here the tube radii are 0.2:
BSplineSurface creates a tensor product B-spline surface defined by a matrix of 3D points:
All the options for BSplineCurve work in the same way. However, for surfaces, you can specify them in each parametric direction separately. For example, the following SplineDegree setting creates a B-spline surface with degree 1 in one direction, and degree 3 in another:
Like the B-spline curves, a rational surface, or NURBS surface, can be created by using SplineWeights. Many computer-aided design applications use NURBS to represent industrial surfaces. The following example generates a right-angle cylindrical tube: