compute_arc_length

PolyData.compute_arc_length(progress_bar=False)

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
progress_barbool, optional

Display a progress bar to indicate progress. Default False.

Returns
float

Arc length of the length of the probed line.

Examples

>>> 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")
../../../_images/pyvista-PolyData-compute_arc_length-1_00_00.png