pyvista.OrthogonalPlanesSource

pyvista.OrthogonalPlanesSource#

class OrthogonalPlanesSource(
bounds: VectorLike[float] = (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0),
*,
resolution: int | VectorLike[int] = 2,
normal_sign: Literal['+', '-'] | Sequence[str] = '+',
names: Sequence[str] = ('yz', 'zx', 'xy'),
)[source]#

Orthogonal planes source.

This source generates three orthogonal planes. The output is a MultiBlock with named plane meshes 'yz', 'zx', 'xy'. The meshes are ordered such that the first, second, and third plane is perpendicular to the x, y, and z-axis, respectively.

Added in version 0.45.

Parameters:
boundsVectorLike[float], default: (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0)

Specify the bounds of the planes in the form: (x_min, x_max, y_min, y_max, z_min, z_max). The generated planes are centered in these bounds.

resolutionint | VectorLike[int], default: 2

Number of points on the planes in the x-y-z directions. Use a single number for a uniform resolution, or three values to set independent resolutions.

normal_sign‘+’ | ‘-’ | sequence[‘+’ | ‘-‘], default: ‘+’

Sign of the plane’s normal vectors. Use a single value to set all normals to the same sign, or three values to set them independently.

namessequence[str], default: (‘xy’,’yz’,’zx’)

Name of each plane in the generated MultiBlock.

Examples

Generate default orthogonal planes.

>>> import pyvista as pv
>>> from pyvista import examples
>>> planes_source = pv.OrthogonalPlanesSource()
>>> output = planes_source.output
>>> output.plot()
../../../_images/pyvista-OrthogonalPlanesSource-1_00_00.png

Modify the planes to fit a mesh’s bounds.

>>> human = examples.download_human()
>>> planes_source.bounds = human.bounds
>>> planes_source.update()

Plot the mesh and the planes.

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(human, scalars='Color', rgb=True)
>>> _ = pl.add_mesh(output, opacity=0.3, show_edges=True)
>>> pl.show()
../../../_images/pyvista-OrthogonalPlanesSource-1_01_00.png

The planes are centered geometrically, but the frontal plane is positioned a bit too far forward. Use push() to move the frontal plane.

>>> planes_source.push(0.0, -10.0, 0)
>>> planes_source.update()
>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(human, scalars='Color', rgb=True)
>>> _ = pl.add_mesh(output, opacity=0.3, show_edges=True, line_width=10)
>>> pl.view_yz()
>>> pl.show()
../../../_images/pyvista-OrthogonalPlanesSource-1_02_00.png

Methods

OrthogonalPlanesSource.push(*distance)

Translate each plane by the specified distance along its normal.

OrthogonalPlanesSource.update()

Update the output of the source.

Attributes

OrthogonalPlanesSource.bounds

Return or set the bounds of the planes.

OrthogonalPlanesSource.names

Return or set the names of the planes.

OrthogonalPlanesSource.normal_sign

Return or set the sign of the plane's normal vectors.

OrthogonalPlanesSource.output

Get the output of the source.

OrthogonalPlanesSource.resolution

Return or set the resolution of the planes.