B-Spline Curve Calculator with De Boor-Cox Recursion


B-Spline Curve Calculator (De Boor-Cox Recursion)

An expert tool to calculate, visualize, and understand B-Spline curves based on control points, degree, and a knot vector using the De Boor-Cox algorithm.


Enter points as `x, y` pairs, one per line. You need at least `p + 1` points.


The degree of the polynomial. A cubic spline (degree 3) is common.


A non-decreasing sequence of numbers. Must have `n + p + 2` knots, where `n` is the number of control points.


The point along the curve to evaluate. Must be within the core knot range. Current: 1.00


Result will appear here.
Visualization of the B-Spline curve, control polygon, and evaluated point.
Intermediate Points (De Boor’s Algorithm)
Recursion Level (r) Points
No calculation yet.

What is a B-Spline Curve?

A B-Spline, or Basis Spline, is a mathematical function used to create smooth, complex curves in computer graphics, computer-aided design (CAD), and other fields of engineering. Unlike simpler curves like Bézier curves, B-Splines offer more localized control; moving a single control point only affects a portion of the curve, which makes them incredibly flexible for design work. This calculator uses the powerful De Boor-Cox recursion algorithm to evaluate points on the curve.

A B-Spline is defined by three key components: a set of Control Points that form a polygon guiding the curve’s shape, a Degree that determines the smoothness and polynomial nature of the curve segments, and a Knot Vector, which is a sequence of non-decreasing numbers that controls where and how the control points affect the curve.

The De Boor-Cox Recursion Formula

The De Boor-Cox algorithm is a numerically stable and efficient method to find a point on a B-spline curve for a given parameter u. It’s a generalization of the de Casteljau’s algorithm used for Bézier curves. The algorithm recursively generates new intermediate control points until the final point on the curve is found.

The recursive formula is as follows:

dj,r(u) = (1 - α) * dj-1,r-1(u) + α * dj,r-1(u)

where α = (u - tj) / (tj+p-r+1 - tj).

Variables Table

Key variables for B-spline calculation
Variable Meaning Unit / Type Typical Range
Pi Control Points Coordinates (x, y) Any valid coordinate space
p Degree Integer 1 (linear), 2 (quadratic), 3 (cubic)
t Knot Vector Sequence of numbers Non-decreasing (e.g., 0, 0, 1, 2, 2)
n Number of Control Points – 1 Integer p to ∞
m+1 Number of knots Integer Must equal n + p + 2
u Evaluation Parameter Number tp to tn+1

Practical Examples

Example 1: A Simple Quadratic Curve (p=2)

Let’s create a simple quadratic curve that starts and ends at the first and last control points (a “clamped” curve).

  • Inputs:
    • Control Points: `(100, 200), (250, 50), (400, 200)` (n=2)
    • Degree (p): `2`
    • Knot Vector: `0, 0, 0, 1, 1, 1` (m+1 = n+p+2 = 2+2+2 = 6 knots)
  • Interpretation: The knot vector has multiplicities of p+1 at the ends, which forces the curve to touch the endpoints. The evaluation parameter u will be valid between 0 and 1.
  • Result at u=0.5: The calculator would process this to find the point C(0.5), which would be `(250, 112.5)`.

Example 2: A Uniform Cubic Curve (p=3)

This example shows a cubic curve where the knots are evenly spaced.

  • Inputs:
    • Control Points: `(50, 50), (150, 250), (350, 250), (450, 50)` (n=3)
    • Degree (p): `3`
    • Knot Vector: `0, 1, 2, 3, 4, 5, 6, 7` (m+1 = n+p+2 = 3+3+2 = 8 knots)
  • Interpretation: This is a “uniform” B-spline. The curve will not necessarily pass through any of the control points. The valid range for u is between t3=3 and t4=4.
  • Result at u=3.5: The calculator would find the point C(3.5), located at the peak of the curve’s arch, `(250, 209.375)`.

How to Use This B-Spline Curve Calculator

  1. Enter Control Points: Type the X and Y coordinates of your control points in the textarea, with each point on a new line (e.g., `100, 150`). You need at least one more control point than the degree (`n+1 > p`).
  2. Set the Degree (p): Choose the polynomial degree. Higher degrees create smoother but computationally more intensive curves. Degree 3 (cubic) is a common choice.
  3. Define the Knot Vector: Enter a comma-separated list of non-decreasing numbers. The number of knots must be exactly equal to the number of control points plus the degree plus one (`m = n + p + 1`, or `m+1` knots total). For a curve that starts and ends at the first and last control points (clamped), repeat the first and last knot `p+1` times.
  4. Select the Evaluation Parameter (u): Use the slider to choose a point `u` along the curve you want to evaluate. The valid range for `u` is between the knot `t[p]` and `t[n+1]`.
  5. Calculate and Interpret: Click “Calculate & Draw Curve”. The canvas will show the resulting curve, the control polygon, and the specific point calculated at `u`. The table below the chart shows the intermediate points generated by De Boor’s algorithm, giving insight into how the final point is constructed.

Key Factors That Affect B-Spline Curves

  • Control Point Position: The primary way to shape the curve. The curve is “pulled” towards its control points.
  • Curve Degree (p): A higher degree results in a smoother, more continuous curve. A degree of 1 creates a simple polyline.
  • Number of Control Points (n+1): More control points allow for more complex and detailed shapes.
  • Knot Vector Values: The values in the knot vector determine the influence of each control point over a given segment of the curve.
  • Knot Multiplicity: Repeating a knot value decreases the level of continuity at that point. A knot with multiplicity `k` means the curve is Cp-k continuous there. Repeating a knot `p` times creates a sharp corner.
  • Clamped vs. Unclamped Knots: Using a clamped knot vector (repeating end knots p+1 times) forces the curve to start and end at the first and last control points, which is often desirable. Bézier curves are a special case of B-splines with clamped knots.

Frequently Asked Questions (FAQ)

1. What is the difference between a B-Spline and a Bézier curve?

A Bézier curve is actually a special case of a B-spline. The main differences are that B-splines can have a degree independent of the number of control points and offer local control. Changing one control point in a Bézier curve affects the entire curve. To learn more, see our Spline Interpolation Deep Dive.

2. What does the error “Invalid knot vector length” mean?

It means the number of knots you entered doesn’t match the required formula: `number of knots = number of control points + degree + 1`. For example, with 5 control points and degree 3, you need `5 + 3 + 1 = 9` knots.

3. Why doesn’t my curve touch the control points?

B-splines are approximating splines, not interpolating. They follow the general shape of the control polygon but don’t necessarily pass through the points unless you force them to by increasing knot multiplicity. A clamped curve will always touch the two endpoints.

4. What is a “uniform” vs. “non-uniform” B-spline?

A uniform B-spline has knots that are evenly spaced (e.g., 0, 1, 2, 3, 4). A non-uniform B-spline can have any non-decreasing knot values. Non-uniform splines are more flexible and are the basis for NURBS (Non-Uniform Rational B-Splines). Learn about what NURBS are here.

5. How do I create a closed loop?

To create a closed curve, your control point list must “wrap around” (the last few points should be the same as the first few), and you must use a periodic (unclamped) knot vector.

6. What is the valid range for the parameter `u`?

The curve is only defined for `u` values between `t[p]` and `t[n+1]`, where `p` is the degree and `n+1` is the number of control points. The calculator automatically sets the slider to this range.

7. Why is the De Boor-Cox algorithm important?

It is a highly efficient and numerically stable method for evaluating the curve, meaning it is less prone to rounding errors in computers compared to directly solving the basis function polynomials. It’s fundamental to modern Computer-Aided Design Basics.

8. Can the units be something other than pixels?

Yes. The calculation is unitless. The control points can represent any coordinate system: inches, meters, or abstract values. The calculator visualizes them in a pixel space for convenience.

Related Tools and Internal Resources

Explore more concepts in geometric modeling and calculation with these related resources:

© 2026 SEO Experts Inc. All Rights Reserved. For educational and professional use in engineering and design.



Leave a Reply

Your email address will not be published. Required fields are marked *