pyvista.core._validation.validate.validate_rotation#
- validate_rotation(
- rotation: pyvista.RotationLike,
- must_have_handedness: Literal['right', 'left'] | None = None,
- name: str = 'Rotation',
Validate a rotation as a 3x3 matrix.
The rotation is valid if its transpose equals its inverse and has a determinant of
1
(right-handed or "proper" rotation) or-1
(left-handed or "improper" rotation). By default, right- and left-handed rotations are allowed. Usemust_have_handedness
to restrict the handedness.- パラメータ:
- rotation
RotationLike
3x3 の回転行列,または SciPy の
Rotation
オブジェクト。- must_have_handedness'right' | 'left' |
None
, default:None
Check if the rotation has a specific handedness. If
right
, the determinant must be1
. Ifleft
, the determinant must be-1
. By default, either handedness is allowed.- name
str
, default: "Rotation" エラーメッセージのバリデーションチェックに失敗した場合に使用する変数名.
- rotation
- 戻り値:
np.ndarray
Validated 3x3 rotation matrix.
例
Validate a rotation matrix. The identity matrix is used as a toy example.
>>> import numpy as np >>> from pyvista import _validation >>> rotation = np.eye(3) >>> _validation.validate_rotation(rotation) array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])
By default, left-handed rotations (which include reflections) are allowed.
>>> rotation *= -1 # Add reflections >>> _validation.validate_rotation(rotation) array([[-1., -0., -0.], [-0., -1., -0.], [-0., -0., -1.]])