How this calculation works
Evaluate a rational tensor-product B-spline surface, its tangent derivatives, unit normal and local curvatures from a weighted control net.
S=A/W; Su=(Au−Wu S)/W; K=(ln−m²)/(EG−F²); H=(En−2Fm+Gl)/(2(EG−F²)).A worked example
The default bilinear surface is S(u,v)=(u,v,uv). At u=v=0.5, its point is(0.5,0.5,0.25), Gaussian curvature−4/9 and mean curvature approximately−0.1360827635.
Good to know
Degrees1–3;2–8 controls per parameter direction, positive weights, valid nondecreasing knots. Parameters strictly inside a non-knot span. Singular or ill-conditioned tangent frames rejected; curvature sign follows Su×Sv.
Reference: NURBS-Python: rational surface evaluation and derivatives (opens in a new tab) ↗
A control net defines an entire surface
A NURBS surface combines two B-spline parameter directions with weighted spatial control points. The control net determines a two-dimensional patch in three-dimensional space. Its rows are not merely samples to be joined by triangles, and most control points need not lie on the evaluated surface.
The calculator evaluates one parameter location and returns its local differential geometry. This separates the geometric model from its display mesh: changing a renderer's sampling density would not change the analytic tangent derivatives at a fixed valid parameter pair.
Compare this with the B spline curve calculator from control points and knot vector. Evaluate a rational tensor-product surface and its differential geometry from CAD control points, weights and two knot vectors.
Reading the two parameter directions
Enter controls in u-major order, with the v index varying fastest. Each row contains x, y, z and a positive weight. The two control counts must multiply to the number of rows, and each degree must be lower than the corresponding number of controls.
A knot vector has control count plus degree plus one entries. Knots must be nondecreasing and define a nonempty parameter domain. This implementation evaluates strictly inside one knot span; endpoints and interior knots are excluded so that the reported second derivatives are not ambiguous across a reduced-continuity join.
The bilinear saddle example
The four default controls have equal weights and produce S(u,v) equal to u, v, u times v. At one-half in each parameter, the spatial point is one-half, one-half, one-quarter. Its two first derivatives are one-zero-one-half and zero-one-one-half.
Their cross product gives the normal proportional to minus-one-half, minus-one-half, one. The resulting Gaussian curvature is minus four-ninths, showing opposite principal bending directions. Mean curvature is about minus 0.1360827635 for this orientation; reversing the normal would reverse that sign but leave Gaussian curvature unchanged.
Differentiating a rational surface
The homogeneous numerator A and scalar denominator W are evaluated with B-spline basis derivatives. Dividing once gives the surface point. Applying the quotient rule then gives first derivatives, followed by second derivatives that also subtract the appropriate weight-derivative terms.
Ignoring those denominator derivatives would be correct only for special constant-weight cases. Nonuniform weights are what let rational patches represent circles and other conic geometry exactly, so treating the control net as an ordinary polynomial surface would discard a central feature of the model.
From derivatives to fundamental forms
The first fundamental form contains E, F and G, the dot products of the two tangent vectors. It describes local lengths and angles in parameter coordinates. A vanishing or poorly conditioned determinant means the parameterization does not supply a reliable two-dimensional tangent frame.
Projecting second derivatives onto the chosen unit normal gives l, m and n, the second fundamental form. Combining both forms yields Gaussian and mean curvature and then the two principal curvatures. The returned derivative arrays make these intermediate steps independently checkable rather than hiding them behind one number.
Orientation, units and weight invariance
Curvature has inverse-length units for mean and principal curvatures, and inverse-length-squared units for Gaussian curvature. Scaling every spatial coordinate by a positive factor changes those quantities accordingly. Merely changing a parameter scale alters derivative components but not the same geometric curvature at a corresponding point.
Multiplying every control weight by the same positive constant should leave the surface and all geometric outputs unchanged. Swapping the u and v parameter directions reverses the cross-product normal, so signed curvatures can reverse. Compare orientation conventions before judging a sign difference against another CAD package.
Where this local result is useful
Use the output to check a patch's normal, detect a saddle or inspect local bending before tessellation. A low curvature at one point does not establish a global approximation error, and a regular local normal does not prove that the entire patch is free of self-intersections.
If evaluation fails at a knot, move into a neighboring span and assess the two sides separately. If the tangent basis is nearly singular, revisit the control layout and parameterization. This page is an evaluator with explicit local checks, not a general-purpose CAD repair or surface-fitting system.
A few questions, answered
Can it evaluate at a repeated knot?
No. This implementation requires a point strictly within a non-knot span for unambiguous second derivatives.
Why does mean curvature change sign?
Its sign depends on the normal chosen from Su cross Sv; reversing that orientation reverses signed mean curvature.
Do control points lie on the surface?
Generally not. Basis functions and weights blend the controls into the evaluated patch.
Does uniform weight scaling change the answer?
No. Multiplying all weights by the same positive constant cancels between numerator and denominator.