mymesh.register.R3d#
- mymesh.register.R3d(alpha, beta, gamma, center=array([0, 0, 0]), rotation_order=[0, 1, 2], rotation_mode='cartesian')[source]#
Generates a rotation matrix for a rotation about a point
\[ \begin{align}\begin{aligned}\begin{split}\mathbf{R_0} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos(\alpha) & -\sin(\alpha) & 0 \\ 0 & \sin(\alpha) & \cos(\alpha) & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\end{split}\\\begin{split}\mathbf{R_1} = \begin{bmatrix} \cos(\beta) & 0 & \sin(\beta) & 0 \\ 0 & 1 & 0 & 0 \\ -\sin(\beta) & 0 & \cos(\beta) & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\end{split}\\\begin{split}\mathbf{R_2} = \begin{bmatrix} \cos(\gamma) & -\sin(\gamma) & 0 & 0 \\ \sin(\gamma) & \cos(\gamma) & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\end{split}\\\mathbf{R_{012}} = \mathbf{R_2} \mathbf{R_1} \mathbf{R_0}\end{aligned}\end{align} \]For a center other than the origin, \(\begin{bmatrix}c_0, c_1, c_2 \end{bmatrix}\):
\(\mathbf{R_c} = \mathbf{T}(\begin{bmatrix}c_0, c_1, c_2 \end{bmatrix}) \mathbf{R_{012}} \mathbf{T}(\begin{bmatrix}-c_0, -c_1, -c_2 \end{bmatrix})\)
- Parameters:
alpha (float) – Rotation about the x, in radians
beta (float) – Rotation about the y, in radians
gamma (float) – Rotation about the z, in radians
center (array_like, optional) – Reference point for the rotation, by default np.array([0,0,0]).
rotation_order (array_like, optional) – Order to perform rotations about the x (0), y (1), and z (2) axes, by default [0,1,2]
- Returns:
r – 4x4 Rotation matrix
- Return type:
np.ndarray