pyvista.DataObjectFilters.rotate

pyvista.DataObjectFilters.rotate#

DataObjectFilters.rotate(
rotation: RotationLike,
point: VectorLike[float] | None = None,
transform_all_input_vectors: bool = False,
inplace: bool = False,
) DataSet | MultiBlock[ソース]#

回転マトリックスまたは Rotation オブジェクトを使用して、点を中心にメッシュを回転させます。

注釈

See also the notes at transform() which is used by this filter under the hood.

パラメータ:
rotationRotationLike

3x3 の回転行列,または SciPy の Rotation オブジェクト。

pointVectorLike[float], optional

回転の焦点を指定します.デフォルトは原点です.

transform_all_input_vectorsbool, default: False

True の時,全ての入力ベクトルは変換される.それ以外の場合は,ポイント,法線,およびアクティブなベクトルだけが変換されます.

inplacebool, default: False

in-placeメッシュを更新します.

戻り値:
DataSet | MultiBlock

Rotated dataset. Return type matches input unless input dataset is a RectilinearGrid, in which case the output datatype is a StructuredGrid.

参考

pyvista.Transform.rotate

回転行列と変換を連結します。

回転を定義します。 ここでは、z軸を中心に60度回転する3x3の行列を使用しています。

>>> import pyvista as pv
>>> rotation = [
...     [0.5, -0.8660254, 0.0],
...     [0.8660254, 0.5, 0.0],
...     [0.0, 0.0, 1.0],
... ]

回転を使って、円錐をその先端を中心に回転させます。

>>> mesh = pv.Cone()
>>> tip = (0.5, 0.0, 0.0)
>>> rot = mesh.rotate(rotation, point=tip)

回転メッシュをプロットします:

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(rot)
>>> _ = pl.add_mesh(mesh, style='wireframe', line_width=3)
>>> _ = pl.add_axes_at_origin()
>>> pl.show()
../../../_images/pyvista-DataObjectFilters-rotate-1_00_00.png