DataObjectFilters.rotate_vector#
- DataObjectFilters.rotate_vector(
- vector: VectorLikeFloat,
- angle: float,
- *,
- point: VectorLikeFloat | None = None,
- transform_all_input_vectors: bool = False,
- inplace: bool = False,
Rotate mesh about a vector.
Note
See also the notes at
transform()which is used by this filter under the hood.- Parameters:
- vector
VectorLikeFloat Vector to rotate about.
- angle
float Angle to rotate.
- point
VectorLikeFloat, optional Point to rotate about. Defaults to origin.
- transform_all_input_vectorsbool, default:
False When
True, all input vectors are transformed. Otherwise, only the points, normals, and active vectors are transformed.- inplacebool, default:
False Updates mesh in-place.
- vector
- Returns:
- output
DataSet|MultiBlock Rotated dataset. Return type matches input.
- output
Examples#
Download Python source code | Download Jupyter notebook
Rotate a mesh 30 degrees about the (1, 1, 1) axis.
>>> import pyvista as pv
>>> mesh = pv.Cube()
>>> rot = mesh.rotate_vector((1, 1, 1), 30, inplace=False)
Plot the rotated mesh.
>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(rot)
>>> _ = pl.add_mesh(mesh, style='wireframe', line_width=3)
>>> _ = pl.add_axes_at_origin()
>>> pl.show()
See Also#
pyvista.Transform.rotate_vectorConcatenate a rotation about a vector with a transformation.
Used In#
API Examples
DataSet.dimensionality(1 use)
Gallery Examples