translate

StructuredGrid.translate(xyz: Union[list, tuple, numpy.ndarray], transform_all_input_vectors=False, inplace=None)

Translate the mesh.

Parameters
xyzlist or tuple or np.ndarray

Length 3 list, tuple or array.

transform_all_input_vectorsbool, optional

When True, all input vectors are transformed. Otherwise, only the points, normals and active vectors are transformed. This is only valid when not updating in place.

inplacebool, optional

Updates mesh in-place.

Returns
pyvista.PointSet

Translated pointset.

Examples

Create a sphere and translate it by (2, 1, 2).

>>> import pyvista
>>> mesh = pyvista.Sphere()
>>> mesh.center
[0.0, 0.0, 0.0]
>>> trans = mesh.translate((2, 1, 2), inplace=True)
>>> trans.center
[2.0, 1.0, 2.0]