Advanced maths

Geodesic distance calculator on triangular surface mesh

This mesh distance calculator finds a shortest route constrained to existing triangular-mesh edges.

Your numbers

3D rows; zero-based indices follow row order.
Rows of three vertex indices.
Integer index of an existing vertex.
Integer index of an existing vertex.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

This mesh distance calculator finds a shortest route constrained to existing triangular-mesh edges. The route is a feasible surface path, so its length is an upper bound on the continuous geodesic. The Euclidean chord supplies a lower bound. Both are shown to keep the approximation visible rather than presenting the edge route as an exact surface solution.

THE FORMULAd_chord≤d_surface≤d_mesh-edges; edge-path length = min over graph paths Σ edge lengths.

A worked example

On a unit square triangulated along edge 0–2, vertices one and three are opposite corners without a direct mesh edge. Their shortest mesh-edge route has length two, while the flat-surface geodesic and chord have length sqrt(2). The difference 2−sqrt(2) bounds how much the returned route may exceed the true surface distance.

Good to know

3–64 distinct spatial vertices, 1–128 valid faces, combinatorial manifold input, endpoints at existing vertices. Dijkstra uses mesh edges only. No face-interior unfolding, exact continuous geodesic, arbitrary barycentric endpoints or fixed approximation ratio. Self-intersections of the embedded mesh are not detected.

A triangle surface is richer than its edge graph

A continuous path may cross a triangle interior at any angle. Restricting travel to the three edges removes those alternatives and can create substantial detours. Finer triangulation may improve the available routes but does not automatically eliminate directional bias or provide a universal relative-error guarantee.

The graph uses the Euclidean length of each existing mesh edge and Dijkstra’s nonnegative-weight algorithm. The returned vertex sequence is therefore shortest within that graph. This is a meaningful exact graph result inside a deliberately approximate surface workflow, and the two claims are labeled separately.

An edge route can be longer than the straight path across two mesh faces0123Edge route: 2Chord: √2Gap: 2 − √2
The unit square is triangulated along diagonal 0–2. Between vertices 1 and 3, the shortest edge route has length two while the flat surface path has length sqrt(2). The returned edge route is an upper bound.

The Initial bearing along a great circle calculator covers a related task. This page focuses on geodesic distance calculator on triangular surface mesh with the method limits and worked example described below.

Lower and upper bounds make the approximation inspectable

The straight spatial chord cannot be longer than any connecting surface path. The edge route is one such surface path, giving a computable bracket for the unknown continuous geodesic. Their difference bounds possible additive overestimation, although a large bracket can be too loose for practical use.

If the lower and upper bounds agree within the chosen precision, the route is correspondingly tight. Otherwise the result should not be substituted into applications requiring exact surface distance. On a curved folded surface, the chord may pass through empty space or the solid interior; that does not invalidate it as a lower bound.

Mesh topology and endpoint membership are checked

The endpoints must refer to actual row indices in the supplied vertex table, and they must belong to the same connected face component. A disconnected pair is rejected rather than assigned an infinite distance that might be mistaken for a large finite route. Duplicate faces and unused vertices also require cleanup.

The manifold audit checks local incidence but does not prove the triangles form a self-intersection-free geometric surface. This page is unrelated to great-circle navigation on an ideal sphere: it follows the finite triangulation and exposes its approximation bounds. Use a continuous mesh-geodesic solver when face-interior crossings are essential.

A few questions, answered

Is the returned route the exact surface geodesic?

No. It is shortest along mesh edges and can overestimate a path crossing face interiors.

Why show the chord?

It gives a universal lower bound, allowing the returned edge route to be bracketed.

Find your calculator

Start typing to explore the library.