skspatial.objects.Cylinder.volume

Cylinder.volume() float64[source]

Return the volume of the cylinder.

The volume \(V\) of a cylinder with radius \(r\) and length \(l\) is

\[V = \pi r^2 l\]
Returns:
np.float64

Volume of the cylinder.

Examples

>>> from skspatial.objects import Cylinder
>>> Cylinder([0, 0, 0], [0, 0, 1], 1).volume().round(5)
np.float64(3.14159)

The length of the vector sets the length of the cylinder.

>>> Cylinder([0, 0, 0], [0, 0, 2], 1).volume().round(5)
np.float64(6.28319)