pyvista.Transform.invert

pyvista.Transform.invert#

Transform.invert() Transform[source]#

Invert the current transformation.

The current transformation matrix (including all matrices in the matrix_list) is inverted every time invert() is called.

Use is_inverted to check if the transformations are currently inverted.

Examples

Concatenate an arbitrary transformation.

>>> import pyvista as pv
>>> transform = pv.Transform().scale(2.0)
>>> transform.matrix
array([[2., 0., 0., 0.],
       [0., 2., 0., 0.],
       [0., 0., 2., 0.],
       [0., 0., 0., 1.]])

Check if the transformation is inverted.

>>> transform.is_inverted
False

Invert the transformation and show the matrix.

>>> _ = transform.invert()
>>> transform.matrix
array([[0.5, 0. , 0. , 0. ],
       [0. , 0.5, 0. , 0. ],
       [0. , 0. , 0.5, 0. ],
       [0. , 0. , 0. , 1. ]])

Check that the transformation is inverted.

>>> transform.is_inverted
True

Invert it again to restore it back to its original state.

>>> _ = transform.invert()
>>> transform.matrix
array([[2., 0., 0., 0.],
       [0., 2., 0., 0.],
       [0., 0., 2., 0.],
       [0., 0., 0., 1.]])
>>> transform.is_inverted
False