liveBook · Manning

Curvature

As explained in Geometry for Programmers

Curvature is a quantity describing how rapidly a geometric curve or surface bends, with signed curvature carrying orientation-dependent sign.

Curvature measures how sharply geometry bends. For a curve, a straight line has curvature 0, while a circle’s curvature increases as its radius shrinks. This turns the everyday idea of “curvy” into a value that can guide geometric code. section 5.0 section 5.2.3

At a point on a curve, imagine fitting the circle that best matches the curve nearby. The fitted circle must share both the point and its tangent vector, but the tangent alone is not enough: curvature also depends on how that tangent changes nearby. For parametric curves, tangent vectors come from derivatives of the coordinate functions, and curvature is associated with second derivatives. section 5.2.3 section 5.2.4

Figure 5.17 The sine graph has positive curvature in -π/2, zero in 0, and negative in π/2.
05-17

Use the sine graph to see that curvature is local and signed: it can be positive, zero, or negative at different points of one curve. section 5.2.3

Keeping curvature signed matters when joining curve pieces. Positive and negative curvature should not be joined as though they naturally flow together. A piecewise parametric curve is continuous and smooth when its coordinate functions are C0 and C1; to keep curvature continuous too, make the coordinate formulas C2. section 5.2.3 section 5.2.4

Curvature constraints can shape polynomial curves, but they have a cost:

  • Set curvature at a chosen point by differentiating the target polynomial twice and adding the resulting condition as a linear equation. section 7.1.1
  • Treat any prescribed derivative as a linear constraint, provided the polynomial has enough coefficients to satisfy it. section 7.1.1
  • Balance extra control against larger polynomials and additional equations, since each new constraint consumes coefficients and computation. section 7.1.1

Smoothing a contour traced from pixels

A contour extracted from an image can begin as many cornered line segments. After fitting its vertices to a threshold isoline, compute tangent vectors at segment endpoints and replace each segment with a cubic polynomial. Splitting those curves into short line segments makes plotting convenient, while the cubic representation produces a visually smooth contour. section 12.4.5

Surface curvature needs a different viewpoint. A curve has one nearby fitting circle at a point; a smooth surface can bend differently along different directions. Fit a tangent plane and its normal vector, then consider the directional curvatures. Mean curvature is their average, or equivalently the mean of the minimum and maximum signed principal curvatures. Minimal surfaces have mean curvature 0 everywhere. section 10.3.1

Figure 10.20 A surface, a tangent plane, its normal vector, and a pair of principal curvatures (Eric Gaba [Sting], CC BY-SA, via Wikimedia Commons)
10-20

The tangent plane, normal vector, and principal curvatures make clear why a surface cannot generally be described by one curve-like curvature value. section 10.3.1

How Geometry for Programmers covers it

How deep it goes
Explains curve curvature through fitting circles, tangents, and second derivatives, then sketches mean and principal surface curvatures.
Examples
Illustrates curvature with lines, circles, a sine graph, constrained polynomials, pixel-derived contours, and tri-periodic minimal surfaces.
What it assumes
Builds from geometric intuition about bending while introducing derivatives, tangent vectors, and second derivatives for computation.
What you can do after
Apply it by constraining polynomial derivatives and smoothing fitted image contours with cubic curve segments.
How it connects
Connects curvature with derivatives, tangent vectors, C2 continuity, parametric curves, polynomial curves, and mean curvature.

Also explained in

Compare how 2 books explain curvature →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.