explainer
Geodesics: shortest arcs and longer routes on a circle
Compare a shortest circle arc, a longer constant-speed geodesic, and a straight chord. Work through angle wrapping, antipodal ties, coincident endpoints, and the metric that defines distance.
What you will learn
- Distinguish a geodesic from a globally shortest route between endpoints.
- Calculate circle arc lengths and compare them with a straight chord.
- Interpolate across an angle seam and handle antipodal or coincident endpoints.
- Explain how the metric and allowed states determine a distance calculation.
Before you start
The headings 170° and −170° are only 20° apart around a circle. Averaging the written angles gives 0°, halfway along a 340° trip in the opposite direction. Both circular routes can be geodesics, even though one is much longer.
This lesson uses the unit circle to make that distinction concrete. You will calculate both routes, compare them with a straight chord, and inspect the cases where a shortest route needs an explicit choice.
Specify the allowed states and their metric
The unit circle contains the points p = (x, y) with x² + y² = 1. A circle-valued state must stay on that set throughout its motion. The manifolds lesson explains why its tangent velocities satisfy p · v = 0.
A Riemannian metric assigns an inner product to tangent vectors at each point. We use the standard circle metric inherited from the plane: g_p(v, w) = v · w. This choice measures curve length using the usual Euclidean speed, while restricting the curve to the circle.
Write p(θ) = (cos θ, sin θ), with θ in radians. For a circle of radius r, a path with continuous angle θ(u) has length:
L = ∫₀¹ r |dθ/du| du
In the experiment, r = 1, and coordinates and lengths are dimensionless. If r were 2 meters, a turn of 0.3 radians would cover 0.6 meters along that physical circle. An angle used to represent a robot heading does not acquire meter units merely because we draw it on a circle.
Changing a metric changes how we measure motion. All distance and constant-speed claims below use this stated standard metric.
Follow a locally straight curve
A geodesic is a curve with zero intrinsic acceleration for the chosen Riemannian metric. On the standard circle, this means that its ambient acceleration has no component along the tangent. The curve can still bend in the surrounding plane.
Choose a signed turn Δ in radians and a starting angle θ_A. The curve:
γ_Δ(u) = (cos(θ_A + uΔ), sin(θ_A + uΔ)), 0 ≤ u ≤ 1
has speed ‖γ_Δ′(u)‖ = |Δ|. Its second derivative is γ_Δ″(u) = −Δ²γ_Δ(u), which points along the radius. Since tangent vectors are perpendicular to the radius, the tangential acceleration is zero.
In dot-product form, its tangent component is γ″ − (γ · γ″)γ = 0. This calculation explains why constant angular motion gives a circle geodesic. Nicolas Boumal's definition of geodesics and embedded acceleration, Section 5.8, develops this connection.
The parameter u is an interpolation fraction. If the motion takes T seconds with u = t/T, its angular speed is Δ/T radians per second. A nonlinear timing rule can trace the same arc with changing speed; our geodesic parameterization uses constant speed, including zero for a constant curve.
Unwrap the angle before interpolating
Angles that differ by a full revolution describe the same circle point. For endpoint angles θ_A and θ_B, each turn θ_B − θ_A + 2πk, where k is an integer, arrives at the same endpoint. Different choices can change the direction or add full loops.
For A = 170° and B = −170°, direct subtraction gives −340°. Adding 360° gives +20°, an equally valid turn between the same endpoints. Positive turns move counterclockwise in our fixed x-y axes.
For a shortest turn, wrap the difference into (−180°, 180°]. The experiment chooses +180° when a half-turn has two equally short directions. This convention selects a representative; it does not change the underlying circle.
Compute the continuous angle θ_A + uΔ first, then evaluate sine and cosine. A short path can pass through +180° and continue to 190°, which describes the same endpoint as −170°. Forcing the intermediate written angle to stay inside a wrapped interval can introduce a coordinate jump in an otherwise smooth motion.
Modern Robotics discusses circle-valued configurations and their coordinates. The geometry remains continuous across the seam of a chosen angle representation.
Compare a geodesic with a shortest route
A circle arc with constant signed turn Δ has length |Δ| at unit radius. The geodesic distance between endpoints is the smallest arc length, so:
d_circle(A, B) = min_k |θ_B − θ_A + 2πk| ∈ [0, π]
To see why, track an angle continuously along any allowed path. Its total angular travel is at least the magnitude of its net turn. A monotone constant-speed arc achieves that bound, and choosing the smallest possible net turn gives the shortest route.
The 20° and −340° routes both have zero intrinsic acceleration. The long route contains short pieces that minimize distance between their own nearby endpoints, yet the full 340° route loses to the 20° route. Boumal's Theorem 10.5 states the general local minimizing property of Riemannian geodesics.
This distinction also appears in a full loop. Returning to your start after one revolution traces a constant-speed geodesic of length 2π. Staying at the starting point connects the same endpoints with length zero.
The experiment shows one selected shortest arc and one arc going the other way, each using at most one revolution. Adding further full turns produces more geodesics, with greater lengths.
Check why the chord leaves the circle
The straight chord interpolates the endpoint vectors directly:
c(u) = (1 − u)A + uB
Because A and B have unit norm, expanding the dot product gives:
‖c(u)‖² = 1 − u(1 − u)‖B − A‖²
For distinct endpoints and 0 < u < 1, the subtracted term is positive. Every interior chord point lies strictly inside the circle. The chord's shorter length therefore does not beat the arc in the circle-constrained problem: it uses forbidden intermediate states.
The chord distance is the Euclidean distance ‖B − A‖. If the shortest angular separation is α in [0, π], it equals 2 sin(α/2) on a unit circle, while the shortest arc length is α. The values agree to first order for small α and differ more at larger separations.
If endpoints coincide, the chord is a constant point on the circle. If they are opposite, the chord midpoint is the origin, which has no heading to normalize.
Work through the angle-seam example
For A = 170° and B = −170°, the endpoint vectors are approximately (−0.984808, 0.173648) and (−0.984808, −0.173648). At u = 0.5:
- Shortest arc: the continuous angle is 170° + 0.5(20°) = 180°, giving (−1, 0).
- Other arc: the angle is 170° + 0.5(−340°) = 0°, giving (1, 0).
- Chord: averaging the endpoint vectors gives (−0.984808, 0), whose norm is approximately 0.984808.
The whole-path lengths are π/9 ≈ 0.349066 for the short arc, 17π/9 ≈ 5.934119 for the long arc, and 2 sin(π/18) ≈ 0.347296 for the chord. The two arcs have a length ratio of 17, even though both arrive at the same endpoint when u reaches 1.
The arc midpoints differ because u measures progress along each chosen path. The chord midpoint remains close to the short arc midpoint, but its norm reveals that it violates the circle constraint.
Explore the tie and coincidence cases
Move the endpoint angles or choose a preset. The blue point follows the selected shortest arc; the green point follows the other arc; the amber point follows the chord. All three use the same interpolation fraction.
Antipodal endpoints sets A = 0° and B = 180°. The +180° and −180° semicircles both have length π, with midpoints (0, 1) and (0, −1). There are exactly two shortest arcs on this circle, and the experiment explicitly reports that the shortest path is not unique.
The blue arc uses +180° as a tie-break. The green arc has the same length in this case, so its label remains Other arc. The chord passes through (0, 0) at u = 0.5.
Across antipodal branch moves B to −175°, making the unique shortest turn −175°. Compare it with B = +175°, whose unique shortest turn is +175°. The endpoint positions are close across the antipode, while their selected shortest-arc midpoints lie on opposite sides of the circle.
That switch is a branch issue in selecting a shortest route. A local rule cannot provide a unique continuous shortest-path choice through the antipodal tie. The distance itself stays continuous as the choice switches.
Coincident endpoints makes A = B = 0°. The unique length-minimizing curve is constant; the other arc makes one positive full turn. At u = 0.5, their points are (1, 0) and (−1, 0), while the chord stays at (1, 0).
Use the right geometry for the task
For a synthetic robot heading transition, circle interpolation can prevent an unintended 340° turn across an angle seam. It supplies a path through orientations. A real motion plan must also account for timing, joint limits, collision constraints, and the dynamics that realize the path.
For unit-norm features in a learning model, angular distance and Euclidean chord distance provide different numerical losses. Both can be useful, but a learned representation does not automatically make either distance meaningful for the task. State the constraint and distance rule before interpreting an interpolation as meaningful data.
The Riemannian exponential map takes an initial tangent vector to a geodesic endpoint. On this circle, let p = (cos θ, sin θ) and let e = (−sin θ, cos θ) be its positive unit tangent. The tangent vector Δe produces Exp_p(Δe) = cos(Δ)p + sin(Δ)e.
Pymanopt's sphere implementation uses the corresponding cosine-and-sine expression and treats normalization as a separate retraction.
The circle also has a group operation through angle addition. A Lie-group exponential uses that group structure, while a Riemannian exponential uses a chosen metric. They agree in this standard circle setting; that agreement does not hold for arbitrary groups and metrics.
Lie groups and Lie algebras explains the algebraic side of the distinction.
For planar poses, the exponential and logarithm maps lesson uses the Lie-group exponential on SE(2). It combines rotation and translation and shows how an inverse logarithm depends on its angular branch, without assuming that the resulting motion is a shortest path.
Reproduce the routes in Python
This standard-library example evaluates both constant-speed arcs and the chord at u = 0.5. It deliberately chooses +180° for an antipodal tie and a +360° other arc for coincident endpoints.
from math import cos, sin, radians, hypot
def point(degrees):
angle = radians(degrees)
return (cos(angle), sin(angle))
def pair(vector):
return '(' + ', '.join(
f'{0.0 if abs(x) < 0.5e-6 else x:.6f}' for x in vector
) + ')'
def compare(start, end, u=0.5):
turn = (end - start + 180) % 360 - 180
if turn == -180:
turn = 180
other = turn - 360 if turn > 0 else turn + 360
a, b = point(start), point(end)
chord = tuple((1-u)*x + u*y for x, y in zip(a, b))
print(f'A={start}, B={end}, u={u:.1f}')
print('Arc points:', pair(point(start+u*turn)), pair(point(start+u*other)))
print(f'Arc lengths: {abs(radians(turn)):.6f}, {abs(radians(other)):.6f}')
print('Chord point:', pair(chord), f'norm={hypot(*chord):.6f}')
print('Unique shortest:', abs(turn) != 180)
compare(170, -170)
compare(0, 180)
compare(0, 0)
A=170, B=-170, u=0.5
Arc points: (-1.000000, 0.000000) (1.000000, 0.000000)
Arc lengths: 0.349066, 5.934119
Chord point: (-0.984808, 0.000000) norm=0.984808
Unique shortest: True
A=0, B=180, u=0.5
Arc points: (0.000000, 1.000000) (0.000000, -1.000000)
Arc lengths: 3.141593, 3.141593
Chord point: (0.000000, 0.000000) norm=0.000000
Unique shortest: False
A=0, B=0, u=0.5
Arc points: (1.000000, 0.000000) (-1.000000, 0.000000)
Arc lengths: 0.000000, 6.283185
Chord point: (1.000000, 0.000000) norm=1.000000
Unique shortest: True
The trigonometric formulas describe exact circle points. Python evaluates them in floating-point arithmetic; the display rounds tiny coordinate residuals to zero. The code assumes finite angles and u between zero and one, as supplied in these examples.
Try it yourself
Exercise 1. Use A = 0° and B = 90°, with u = 0.5. Find both arc midpoints, the chord midpoint, and all three whole-path lengths. Explain why the smaller chord length does not solve the circle-constrained shortest-path problem.
Show solution 1
The shortest turn is +90° = π/2, so its midpoint is (√2/2, √2/2). The other turn is −270° = −3π/2, whose midpoint is (−√2/2, −√2/2).
The chord midpoint is (0.5, 0.5), with norm 1/√2, so it lies inside the circle. Whole-path lengths are π/2 ≈ 1.570796, 3π/2 ≈ 4.712389, and √2 ≈ 1.414214. The chord uses intermediate points outside the allowed state set.
Exercise 2. Start at (1, 0). First end at (−1, 0), then end back at (1, 0). For each case, identify the shortest length and whether the shortest curve is unique. How can a constant-speed full circle still be a geodesic in the second case?
Show solution 2
The opposite endpoint gives shortest length π, with two distinct minimizing semicircles. They travel in opposite directions and have equal length.
The identical endpoint gives shortest length 0, attained by the unique constant curve. A full circle has length 2π and has radial ambient acceleration everywhere, so it remains a geodesic. Its sufficiently short pieces minimize their own endpoint distances; the complete loop does not minimize distance between its coincident endpoints.
Continue with exponential and logarithm maps to construct and recover planar rigid motions, with explicit choices for the angular branch.
Sources and further study
- Nicolas Boumal: An Introduction to Optimization on Smooth Manifolds. Section 5.8 defines intrinsic acceleration and geodesics; Section 10.1 distinguishes minimizing curves from locally minimizing geodesics; Section 7.4 discusses the metric behind the rotation-group exponential agreement.
- Modern Robotics: Configuration Space Topology. Circle-valued configurations, intrinsic dimension, and the difference between a state space and a coordinate representation.
- Pymanopt: Sphere implementation. The standard metric, angular distance, exponential update, and normalized retraction in an implemented sphere model.