pyvista.Transform.translate#
- Transform.translate( ) Transform [source]#
Concatenate a translation matrix.
Create a translation matrix and
concatenate()
it with the current transformationmatrix
according to pre-multiply or post-multiply semantics.Internally, the matrix is stored in the
matrix_list
.- Parameters:
- *vector
VectorLike
[float
] Vector to use for the translation.
- 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.
- *vector
See also
pyvista.DataSet.translate()
Translate a mesh.
Examples
Concatenate a translation matrix.
>>> import pyvista as pv >>> transform = pv.Transform().translate(1, 2, 3) >>> transform.matrix array([[1., 0., 0., 1.], [0., 1., 0., 2.], [0., 0., 1., 3.], [0., 0., 0., 1.]])
Concatenate a second translation matrix using
+
.>>> transform = transform + (1, 1, 1) >>> transform.matrix array([[1., 0., 0., 2.], [0., 1., 0., 3.], [0., 0., 1., 4.], [0., 0., 0., 1.]])