v#
- QuaternionArray.v#
Vector part of all Quaternions.
Having the quaternion elements \(\mathbf{q}_i=\begin{pmatrix}w_i & \mathbf{v}_i\end{pmatrix}=\begin{pmatrix}w_i & x_i & y_i & z_i\end{pmatrix}\in\mathbb{R}^4\) stacked vertically in an \(N\times 4\) matrix \(\mathbf{Q}\):
\[\begin{split}\mathbf{Q} = \begin{bmatrix} \mathbf{q}_0 \\ \mathbf{q}_1 \\ \vdots \\ \mathbf{q}_{N-1} \end{bmatrix} = \begin{bmatrix} w_0 & x_0 & y_0 & z_0 \\ w_1 & x_1 & y_1 & z_1 \\ \vdots & \vdots & \vdots & \vdots \\ w_{N-1} & x_{N-1} & y_{N-1} & z_{N-1} \end{bmatrix}\end{split}\]The vector parts of all quaternions are:
\[\begin{split}\mathbf{V} = \begin{bmatrix} x_0 & y_0 & z_0 \\ x_1 & y_1 & z_1 \\ \vdots & \vdots & \vdots \\ x_{N-1} & y_{N-1} & z_{N-1} \end{bmatrix}\end{split}\]- Returns:
V – N-by-3 array with vector parts of all quaternions.
- Return type:
numpy.ndarray
Examples
>>> Q = QuaternionArray(np.random.random((3, 4))-0.5) >>> Q.view() QuaternionArray([[ 0.39338362, -0.29206111, -0.07445273, 0.86856573], [ 0.65459935, 0.14192058, -0.69722158, 0.25542183], [-0.42837174, 0.85451579, -0.02786928, 0.29244439]]) >>> Q.v array([[-0.29206111, -0.07445273, 0.86856573], [ 0.14192058, -0.69722158, 0.25542183], [ 0.85451579, -0.02786928, 0.29244439]])
They can also be accessed directly, slicing the Quaternion like an array, but returned as a Quaternion object.
>>> Q[:, 1:] QuaternionArray([[-0.29206111, -0.07445273, 0.86856573], [ 0.14192058, -0.69722158, 0.25542183], [ 0.85451579, -0.02786928, 0.29244439]])