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'),
Orthogonal planes source.
This source generates three orthogonal planes. The
output
is aMultiBlock
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:
- bounds
VectorLike
[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.- resolution
int
|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
.
- bounds
Examples
Generate default orthogonal planes.
>>> import pyvista as pv >>> from pyvista import examples >>> planes_source = pv.OrthogonalPlanesSource() >>> output = planes_source.output >>> output.plot()
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()
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()
Methods
OrthogonalPlanesSource.push
(*distance)Translate each plane by the specified distance along its normal.
Update the output of the source.
Attributes
Return or set the bounds of the planes.
Return or set the names of the planes.
Return or set the sign of the plane's normal vectors.
Get the output of the source.
Return or set the resolution of the planes.