- PolyDataFilters.geodesic(start_vertex, end_vertex, inplace=False, keep_order=True, progress_bar=False)¶
Calculate the geodesic path between two vertices using Dijkstra’s algorithm.
This will add an array titled
'vtkOriginalPointIds'of the input mesh’s point ids to the output mesh. The default behavior of the underlying
vtkDijkstraGraphGeodesicPathfilter is that the geodesic path is reversed in the resulting mesh. This is overridden in PyVista by default.
Vertex index indicating the start point of the geodesic segment.
Vertex index indicating the end point of the geodesic segment.
Whether the input mesh should be replaced with the path. The geodesic path is always returned.
True, the points of the returned path are guaranteed to start with the start vertex (as opposed to the end vertex).
New in version 0.32.0.
Display a progress bar to indicate progress.
PolyDataobject consisting of the line segment between the two given vertices. If
Truethis is the same object as the input mesh.
Plot the path between two points on the random hills mesh.
>>> import pyvista as pv >>> from pyvista import examples >>> hills = examples.load_random_hills() >>> path = hills.geodesic(560, 5820) >>> pl = pv.Plotter() >>> _ = pl.add_mesh(hills) >>> _ = pl.add_mesh(path, line_width=5, color='k') >>> pl.show()
See Geodesic Paths for more examples using this filter.