pyvista.Capsule

Contents

pyvista.Capsule#

Capsule(
center=(0.0, 0.0, 0.0),
direction=(1.0, 0.0, 0.0),
radius=0.5,
cylinder_length=1.0,
resolution=30,
)[source]#

Create the surface of a capsule.

Warning

pyvista.Capsule() function rotates the pyvista.CapsuleSource ‘s pyvista.PolyData in its own way. It rotates the pyvista.CapsuleSource.output 90 degrees in z-axis, translates and orients the mesh to a new center and direction.

Note

A class:pyvista.CylinderSource is used to generate the capsule mesh. For vtk versions below 9.3, a class:pyvista.CapsuleSource is used instead. The mesh geometries are similar but not identical.

Added in version 0.44.0.

Parameters:
centersequence[float], default: (0.0, 0.0, 0.0)

Location of the centroid in [x, y, z].

directionsequence[float], default: (1.0, 0.0, 0.0)

Direction the capsule points to in [x, y, z].

radiusfloat, default: 0.5

Radius of the capsule.

cylinder_lengthfloat, default: 1.0

Cylinder length of the capsule.

resolutionint, default: 30

Number of points on the circular face of the cylinder.

Returns:
pyvista.PolyData

Capsule surface.

See also

pyvista.Cylinder

Examples

Create a capsule using default parameters.

>>> import pyvista as pv
>>> capsule = pv.Capsule()
>>> capsule.plot(show_edges=True)
../../../_images/pyvista-Capsule-1_00_00.png