pyvista.Transform.shear_matrix

pyvista.Transform.shear_matrix#

property Transform.shear_matrix: NumpyArray[float][source]#

Return the shear component of the current transformation matrix as a 3x3 matrix.

Added in version 0.47.

Examples

Compose a symmetric shear matrix.

>>> import numpy as np
>>> import pyvista as pv
>>> shear = np.eye(4)
>>> shear[0, 1] = 0.1
>>> shear[1, 0] = 0.1
>>> trans = pv.Transform(shear)

Get the shear matrix. The shear matrix is the same as the input in this particular example, but in general this is not the case.

>>> trans.shear_matrix
array([[1. , 0.1, 0. ],
       [0.1, 1. , 0. ],
       [0. , 0. , 1. ]])

Compose an asymmetric shear matrix instead.

>>> shear = np.eye(4)
>>> shear[0, 1] = 0.1
>>> trans = pv.Transform(shear)

Get the shear matrix. In this case, shear differs from the input because asymmetric shear can be decomposed into scale factors and a rotation.

>>> trans.shear_matrix
array([[1.        , 0.05      , 0.        ],
       [0.04975124, 1.        , 0.        ],
       [0.        , 0.        , 1.        ]])
>>> trans.scale_factors
(0.9987523388778445, 1.0037461005722337, 1.0)
>>> axis, angle = trans.rotation_axis_angle
>>> axis
(0.0, 0.0, -1.0)
>>> angle
2.8624