skspatial.objects.Cylinder.to_mesh

Cylinder.to_mesh(n_along_axis: int = 100, n_angles: int = 30) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Return coordinate matrices for the 3D surface of the cylinder.

Parameters
n_along_axisint

Number of intervals along the axis of the cylinder.

n_anglesint

Number of angles distributed around the circle.

Returns
X, Y, Z: (n_angles, n_angles) ndarray

Coordinate matrices.

Examples

>>> from skspatial.objects import Cylinder
>>> X, Y, Z = Cylinder([0, 0, 0], [0, 0, 1], 1).to_mesh(2, 4)
>>> X.round(3)
array([[-1. , -1. ],
       [ 0.5,  0.5],
       [ 0.5,  0.5],
       [-1. , -1. ]])
>>> Y.round(3)
array([[ 0.   ,  0.   ],
       [ 0.866,  0.866],
       [-0.866, -0.866],
       [-0.   , -0.   ]])
>>> Z.round(3)
array([[0., 1.],
       [0., 1.],
       [0., 1.],
       [0., 1.]])