pyvista.Transform.compose#
- Transform.compose( ) Transform [ソース]#
Compose a transformation matrix.
Create a 4x4 matrix from any transform-like input and compose it with the current transformation
matrix
according to pre-multiply or post-multiply semantics.Internally, the matrix is stored in the
matrix_list
.- パラメータ:
- transform
TransformLike
Any transform-like input such as a 3x3 or 4x4 array or matrix.
- multiply_mode'pre' | 'post',
optional
Multiplication mode to use when concatenating the matrix. By default, the object's
multiply_mode
is used, but this can be overridden. Set this to'pre'
for pre-multiplication or'post'
for post-multiplication.
- transform
例
Define an arbitrary 4x4 affine transformation matrix and compose it.
>>> import pyvista as pv >>> array = [ ... [0.707, -0.707, 0, 0], ... [0.707, 0.707, 0, 0], ... [0, 0, 1, 1.5], ... [0, 0, 0, 2], ... ] >>> transform = pv.Transform().compose(array) >>> transform.matrix array([[ 0.707, -0.707, 0. , 0. ], [ 0.707, 0.707, 0. , 0. ], [ 0. , 0. , 1. , 1.5 ], [ 0. , 0. , 0. , 2. ]])
Define a second transformation and use
+
to compose it.>>> array = [[1, 0, 0], [0, 0, -1], [0, -1, 0]] >>> transform = transform * array >>> transform.matrix array([[ 0.707, -0.707, 0. , 0. ], [ 0. , 0. , -1. , -1.5 ], [-0.707, -0.707, 0. , 0. ], [ 0. , 0. , 0. , 2. ]])