pyvista.PolyDataFilters.geodesic_distance#

PolyDataFilters.geodesic_distance(start_vertex, end_vertex, use_scalar_weights=False, progress_bar=False)[source]#

Calculate the geodesic distance between two vertices using Dijkstra’s algorithm.

Parameters:
start_vertexint

Vertex index indicating the start point of the geodesic segment.

end_vertexint

Vertex index indicating the end point of the geodesic segment.

use_scalar_weightsbool, default: False

If True, use scalar values in the edge weight. This only works for point data.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
float

Length of the geodesic segment.

Examples

>>> import pyvista as pv
>>> sphere = pv.Sphere()
>>> length = sphere.geodesic_distance(0, 100)
>>> f'Length is {length:.3f}'
'Length is 0.812'

See Geodesic Paths for more examples using this filter.