pyvista.DataSetFilters.transform#
- DataSetFilters.transform(
- trans: TransformLike,
- transform_all_input_vectors: bool = False,
- inplace: bool | None = None,
- progress_bar: bool = False,
このメッシュを4x4変換で変換します.
警告
transform_all_input_vectors=True
を使用した場合,VTKでは3つの成分を持つベクターと配列の区別がありません. これは,3つの成分を持つスカラーデータ(RGBデータなど)がある場合に問題となることがあります. これは,スカラーデータではなくベクトルデータであるかのように,不適切に変換されます. 3つの成分を別々のスカラー配列として格納するという回避策が考えられます(醜いですが).警告
一般的に,変換を行うと非整数の結果が得られます.このメソッドは,変換を行う前に整数型のベクトルデータを float に変換します.これは points 配列だけでなく,変換の影響を受けるすべてのベクトル値のデータにも適用されます.インプレース変換で結果が整数に切り捨てられることによる微妙なバグを防ぐために,この変換は常に入力メッシュに適用されます.
警告
Shear transformations are not supported for '
ImageData
. If present, any shear component is removed by the filter.注釈
Transforming
ImageData
modifies itsorigin
,spacing
, anddirection_matrix
properties.バージョン 0.45.0 で非推奨: inplace was previously defaulted to True. In the future this will change to False.
- パラメータ:
- 戻り値:
pyvista.DataSet
Transformed dataset. Return type matches input unless input dataset is a
pyvista.RectilinearGrid
, in which case the output datatype is apyvista.StructuredGrid
.
参考
pyvista.Transform
4x4行列による線形変換を説明します。
例
(50, 100, 200)
によるメッシュの変換>>> import numpy as np >>> from pyvista import examples >>> mesh = examples.load_airplane()
Here a 4x4
numpy.ndarray
is used, but anyTransformLike
is accepted.>>> transform_matrix = np.array( ... [ ... [1, 0, 0, 50], ... [0, 1, 0, 100], ... [0, 0, 1, 200], ... [0, 0, 0, 1], ... ] ... ) >>> transformed = mesh.transform(transform_matrix, inplace=False) >>> transformed.plot(show_edges=True)