cartan

Geodesics

Geodesic<M> represents the parameterized curve for , providing evaluation, sampling, and arc-length computation.

Summary

PropertyValue
StructGeodesic<'a, M: Manifold>
Parameterization
base point
endpoint
Arc length on
Validity

Construction

From point and tangent vector:

use cartan_geo::Geodesic;
use cartan::manifolds::Sphere;
use cartan::prelude::*;
 
let s2 = Sphere::<3>;
let p = [1.0_f64, 0.0, 0.0];  // north pole
let v = s2.project_tangent(&p, &[0.0_f64, 1.0, 0.0]);
 
let geo = Geodesic::new(&s2, p, v);

From two points (velocity = , so ):

let p = [1.0_f64, 0.0, 0.0];
let q = [0.0_f64, 1.0, 0.0];
 
let geo = Geodesic::from_two_points(&s2, p, &q).unwrap();
// geo.eval(1.0) ≈ q

from_two_points returns Err if and are at the cut locus (antipodal on ).

Methods

geo.eval(t)      // -> M::Point:  gamma(t)
geo.length()     // -> f64:       ||velocity||
geo.midpoint()   // -> M::Point:  gamma(0.5)
geo.sample(n)    // -> Vec<M::Point>: n evenly spaced points on [0,1]

Sampling example

// 5 points evenly spaced from p to q on S²
let pts = geo.sample(5);
// pts[0] = p, pts[4] = q, pts[2] = midpoint
assert!((s2.dist(&pts[0], &p)).abs() < 1e-12);

Arc length

let len = geo.length();
// For a unit-speed geodesic (||v|| = 1), len = geodesic distance
let dist = s2.dist(&p, &geo.eval(1.0));
assert!((len - dist).abs() < 1e-10);

Numerical Notes

Valid range: the exponential map is well-defined for all on complete manifolds, but from_two_points will return Err at the cut locus. For , this is the antipodal point; for SO(N), it is rotations of angle .

Unit-speed: the geodesic is not normalized by default. Set velocity = log_p(q) / dist(p,q) to get a unit-speed parameterization where eval(t) moves units of arc length from base.

Applications

  • Path planning: smooth interpolation between configurations on SE(3)
  • Visualization: drawing geodesic arcs on manifold surfaces
  • Numerical integration: solving ODEs along geodesics
  • Conjugate point detection: see Jacobi Fields