pyvista.Transform.translate#
- Transform.translate( ) Transform[source]#
Compose a translation matrix.
Create a translation matrix and
compose()it with the current transformationmatrixaccording to pre-multiply or post-multiply semantics.Internally, the matrix is stored in the
matrix_list.- Parameters:
- *vector
float|VectorLike[float] Vector to use for translation. May be a single vector (one arg) or unpacked vector (three args).
- multiply_mode‘pre’ | ‘post’,
optional Multiplication mode to use when composing the matrix. By default, the object’s
multiply_modeis used, but this can be overridden. Set this to'pre'for pre-multiplication or'post'for post-multiplication.
- *vector
See also
pyvista.DataObjectFilters.translateTranslate a mesh.
Examples
Compose 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.]])
Compose 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.]])