B-Spline Basis Calculator
Introduction to B-Spline Basis Evaluation
This B-spline basis calculator evaluates the Cox-de Boor basis functions that sit underneath a spline curve. When you enter a knot vector, a spline degree, and a parameter value t, the page returns the basis values Ni,k(t) for every valid index i. In plain language, those numbers are the blending weights that tell you how strongly each control point would influence the curve at that parameter location. If you work in CAD, computer graphics, geometric design, isogeometric analysis, or NURBS programming, this is the small but crucial layer of math that explains why the final curve bends the way it does.
The calculator is useful because B-spline errors are often subtle. A curve can look only slightly wrong while the underlying cause is an indexing slip, a degree mismatch, or one repeated knot in the wrong place. Looking directly at the basis values is often the fastest way to debug that situation. Students can confirm whether their hand calculations agree with the recursive definition. Developers can compare the output against a code implementation. Engineers can inspect whether local support and partition of unity are behaving as expected before they move on to control-point geometry.
A B-spline basis has several properties worth noticing while you test inputs. Each basis function is nonnegative, each one is active only over a limited interval of the knot vector, and the active functions in the interior of the spline domain typically add up to 1. Those properties are the reason B-splines are so practical: they produce smooth blending, preserve affine combinations of control points, and give local control instead of global distortion. The calculator below lets you see those ideas numerically instead of leaving them as abstract textbook statements.
One practical detail is the count of basis functions. If your knot vector has length m and your degree is k, the calculator returns m - k - 1 basis values. That same count is also the number of control points required for a corresponding non-rational B-spline curve. So the output array is not just a list of numbers to inspect on its own; it is also the exact list of weights you would pair with control points in a downstream curve or surface evaluator.
How to use the B-Spline Basis Calculator
To use this B-spline basis calculator effectively, begin with the knot vector. Enter the knots as a non-decreasing sequence separated by commas or spaces, such as 0,0,0,1,2,3,3,3. The knot vector determines the parameter spans, the support of each basis function, and the continuity at each knot. Repeated knots are allowed, but they shrink support and reduce smoothness at the repeated location, which is exactly why many spline examples use multiplicities at the ends.
Next, choose the spline degree k. Degree 0 gives piecewise constant basis functions, degree 1 gives piecewise linear functions, degree 2 gives quadratic blending, and degree 3 gives the cubic case that appears frequently in modeling and CAD systems. Finally, enter the parameter value t. The units of t are the same as the units used in the knot vector, so if your knots run from 0 to 3, a value like 1.5 sits halfway through the middle span. The calculator checks whether the chosen t lies in the active domain and warns you when it does not.
| Input | What it means | Typical example |
|---|---|---|
| Knot vector | A non-decreasing sequence that defines the parameter partition and local support of each basis function. | 0,0,0,1,2,3,3,3 |
| Degree | The polynomial degree of the basis. Higher degree usually means smoother blending if knots are simple. | 2 for quadratic or 3 for cubic |
| Parameter t | The point in the parameter domain where the basis functions are evaluated. | 1.5 |
After you click Evaluate, the result area lists one basis value for each valid index. In most interior evaluations, only a small cluster of neighboring basis functions will be nonzero. That behavior is not a bug. It is the defining local-support property of B-splines, and it is what lets a single control point move one region of a curve without dragging the entire shape with it.
If you are checking a software implementation, it helps to run more than one parameter value through the same knot vector. Try a point near the left boundary, one in the middle, and one near the right boundary. You will see the nonzero weights shift smoothly from lower-index basis functions to higher-index ones. The copy button then lets you move the values into unit tests, debugging notes, or a code comment without retyping them.
Formula for Cox-de Boor B-Spline Basis Functions
The B-spline basis calculator applies the standard Cox-de Boor recursion. At degree 0, a basis function is simply an indicator for one knot span. At higher degrees, each basis function is built from two lower-degree basis functions multiplied by knot-dependent blending factors. This recursive structure is the reason B-splines can be both smooth and local at the same time: each higher-degree function is assembled from nearby lower-degree pieces rather than from one global polynomial.
For degree 0, Ni,0(t) equals 1 on its knot interval and 0 elsewhere. For degree k > 0, the recursion blends Ni,k-1(t) and Ni+1,k-1(t). The first term grows from the left side of the support interval, and the second term fades toward the right side. When repeated knots cause a denominator to become zero, the corresponding term is taken to be zero. That convention is standard in spline literature and is exactly what prevents undefined divisions from corrupting the computation.
In MathML notation, each scalar B-spline basis function is a real-valued function of the parameter:
The most important geometric consequence is local support. A basis function Ni,k(t) is nonzero only on a limited interval, usually written as [ti, ti+k+1). That is why most entries in the result array are exactly zero. Only the few basis functions whose support covers the chosen parameter value can contribute to the blend.
When those scalar basis values are combined with control points Pi, they produce the actual point on the curve:
This calculator stops one step before the geometry stage on purpose. By isolating the basis values, it helps you verify the exact scalar weights before you mix in control-point coordinates or rational NURBS weights. In debugging practice, that separation is extremely helpful because it tells you whether the error lives in basis evaluation or in the later curve assembly.
Example: Evaluating a Quadratic B-Spline Basis at t = 1.5
This B-spline basis example uses the open uniform quadratic knot vector [0, 0, 0, 1, 2, 3, 3, 3] with degree 2. It is a classic test case because it is simple enough to reason about by hand while still showing the smooth overlap that makes higher-degree B-splines useful. If you evaluate the basis at t = 1.5, the active quadratic basis functions are the ones whose support covers the middle interval. The others are zero because their support lies entirely to the left or right.
To reproduce the example with the calculator, enter the knot vector as 0,0,0,1,2,3,3,3, set the degree to 2, and try t values of 0.5, 1.5, and 2.5. Those three points are useful because they show the blend sliding from the left side of the spline toward the center and then toward the right side. At t = 1.5, the expected pattern is a strong middle weight with two smaller neighbors, which is exactly the shape you want for smooth local blending.
| t | N0,2(t) | N1,2(t) | N2,2(t) | N3,2(t) | N4,2(t) |
|---|---|---|---|---|---|
| 0.5 | 0.250 | 0.625 | 0.125 | 0.000 | 0.000 |
| 1.5 | 0.000 | 0.125 | 0.750 | 0.125 | 0.000 |
| 2.5 | 0.000 | 0.000 | 0.125 | 0.625 | 0.250 |
This worked B-spline example highlights three checks that are worth repeating on your own inputs. First, only a few basis functions are nonzero at any one parameter value, which confirms local support. Second, each row sums to 1, which confirms partition of unity. Third, as t moves from 0.5 to 2.5, the dominant weight shifts from lower-index basis functions toward higher-index ones. When these weights are later multiplied by control points, that sliding dominance becomes smooth motion along the curve.
Reading and interpreting B-Spline basis results
The B-spline basis result array is easiest to read as a list of blending weights. If the calculator returns [0.000000, 0.125000, 0.750000, 0.125000, 0.000000], the middle basis function is carrying most of the influence at that parameter while its two neighbors make smaller contributions. That is exactly the pattern you expect near the middle of the quadratic example above. Because standard B-spline bases are nonnegative, a negative value is usually a sign that an input assumption or outside implementation needs review.
- Non-negativity: standard B-spline basis values should not be negative.
- Partition of unity: interior values usually add up to 1, which is why affine combinations of control points behave predictably.
- Local support: many entries will be exactly zero because only nearby basis functions overlap a chosen parameter value.
- Repeated knots: duplicates reduce smoothness and can make the nonzero region narrower or the transition sharper.
The sum message in the result box is a quick diagnostic rather than a decorative note. If the sum is very close to 1, the basis is behaving in the normal interior way. If the sum differs noticeably, the most common reasons are that the degree is inconsistent with the knot vector, the parameter lies at an awkward boundary case, or the input is not the knot sequence you intended. Small display differences are still normal because the page rounds values for readability.
Limitations and assumptions for this B-Spline basis calculator
This B-spline basis calculator is intentionally focused on evaluating scalar, non-rational basis functions. That narrow scope makes the output easy to inspect and compare, but it also means the page assumes a standard spline setup. The knot vector must be non-decreasing, the degree must be a whole number zero or greater, and the knot vector must be long enough relative to the degree to define at least one basis function.
The page also follows the usual Cox-de Boor convention that zero-denominator terms contribute zero. That is the correct way to handle repeated knots in ordinary B-spline evaluation, but it does not turn the calculator into a full NURBS tool. If you need rational basis functions, weighted control points, homogeneous coordinates, or a plotted curve, those belong in a separate step outside this page.
- Non-decreasing knots only: a decreasing knot vector does not define a standard B-spline basis.
- Open knots are common but not required: the calculator allows any non-decreasing knot vector, not only open uniform ones.
- Parameter range matters: values of t outside the active domain often produce all zeros or boundary behavior that is not useful for design work.
- No plotting of full geometry: this page computes basis numbers, not full spline curves or surfaces.
- Floating-point rounding: displayed decimals are rounded, so exact symbolic identities may appear with tiny numeric differences.
- Recursive evaluation cost: the implementation is meant for clarity and correctness, not for large-scale performance benchmarking.
Those limitations are usually acceptable because basis inspection is often a mid-step inside a larger workflow. You might use the output here to validate a curve evaluator, confirm a classroom exercise, check a knot insertion routine, or study how degree and multiplicity affect locality. In each of those cases, the first thing you need is confidence that the raw basis values are correct. That is the specific job this calculator is designed to do.
Mini-game: Basis Peak Dash
This optional mini-game turns the calculator idea into a fast timing challenge. Instead of typing a parameter and reading the basis weights, you watch a glowing parameter line sweep across live B-spline basis curves. Your job is to strike when the line crosses the peak of the highlighted basis function. The mechanic is simple on purpose: it trains your eye to notice where a basis function is strongest, how local support limits where it can matter, and how repeated knots can make a target narrower.
The game does not change the calculator result above. It is simply a visual, replayable way to build intuition. If you can consistently hit the right peak, you are learning exactly what the numeric output is telling you: at each parameter value, one small neighborhood of basis functions dominates the blend and the dominant one shifts smoothly as t moves through the knot vector.
Target: N1,2(t) near its peak.
Degree 2 ยท Knots 0,0,0,1,2,3,3,3
Best score is saved on this device. The mini-game is separate from the calculator and exists only to make basis behavior easier to see and remember.
