Transform.invert#
- Transform.invert() Transform[source]#
Invert the current transformation.
The current transformation
matrix(including all matrices in thematrix_list) is inverted every timeinvert()is called.Use
is_invertedto check if the transformations are currently inverted.
Examples#
Download Python source code | Download Jupyter notebook
Compose 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