pyvista.Sphere#

Sphere(radius=0.5, center=(0.0, 0.0, 0.0), direction=(0.0, 0.0, 1.0), theta_resolution=30, phi_resolution=30, start_theta=0.0, end_theta=360.0, start_phi=0.0, end_phi=180.0)[source]#

Create a sphere.

Parameters:
radiusfloat, default: 0.5

Sphere radius.

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

Center in [x, y, z].

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

Direction vector in [x, y, z] pointing from center to the sphere’s north pole at zero degrees latitude.

theta_resolutionint, default: 30

Set the number of points in the longitude direction (ranging from start_theta to end_theta).

phi_resolutionint, default: 30

Set the number of points in the latitude direction (ranging from start_phi to end_phi).

start_thetafloat, default: 0.0

Starting longitude angle in degrees [0, 360].

end_thetafloat, default: 360.0

Ending longitude angle in degrees [0, 360].

start_phifloat, default: 0.0

Starting latitude angle in degrees [0, 180].

end_phifloat, default: 180.0

Ending latitude angle in degrees [0, 180].

Returns:
pyvista.PolyData

Sphere mesh.

Examples

Create a sphere using default parameters.

>>> import pyvista
>>> sphere = pyvista.Sphere()
>>> sphere.plot(show_edges=True)
https://d33wubrfki0l68.cloudfront.net/0d592cbb1501d0b538269a19ce84e56f7cbf894b/86cf9/_images/pyvista-sphere-1_00_00.png

Create a quarter sphere by setting end_theta.

>>> sphere = pyvista.Sphere(end_theta=90)
>>> out = sphere.plot(show_edges=True)
https://d33wubrfki0l68.cloudfront.net/c2ad70c979eb0cb56a488e745f00ef823cf5e0db/c73e9/_images/pyvista-sphere-1_01_00.png

Create a hemisphere by setting end_phi.

>>> sphere = pyvista.Sphere(end_phi=90)
>>> out = sphere.plot(show_edges=True)
https://d33wubrfki0l68.cloudfront.net/a225e2e32420ce365b2deb5cc39e00a7a552728d/f09e6/_images/pyvista-sphere-1_02_00.png