PolyDataFilters.compute_arc_length#
- PolyDataFilters.compute_arc_length(*, progress_bar: bool = False) PolyData[source]#
Compute the arc length over the length of the probed line.
It adds a new point-data array named
"arc_length"with the computed arc length for each of the polylines in the input. For all other cell types, the arc length is set to 0.- Parameters:
- Returns:
pyvista.PolyDataMesh with the
"arc_length"point data array.
Examples#
Download Python source code | Download Jupyter notebook
>>> import pyvista as pv
>>> sphere = pv.Sphere()
>>> path = sphere.geodesic(0, 100)
>>> length = path.compute_arc_length()['arc_length'][-1]
>>> f'Length is {length:.3f}'
'Length is 0.812'
This is identical to the geodesic_distance.
>>> length = sphere.geodesic_distance(0, 100)
>>> f'Length is {length:.3f}'
'Length is 0.812'
You can also plot the arc_length.
>>> arc = path.compute_arc_length()
>>> arc.plot(scalars='arc_length')
Used In#
Gallery Examples