x#

Quaternion.x#

First element of the vector part of the Quaternion.

Given a quaternion \(\mathbf{q}=\begin{pmatrix}q_w & \mathbf{q}_v\end{pmatrix} = \begin{pmatrix}q_w & q_x & q_y & q_z\end{pmatrix}\), the first element of the vector part is \(q_x\).

Returns:

x – First element of vector part of the quaternion.

Return type:

float

Examples

>>> q = Quaternion([2.0, -3.0, 4.0, -5.0])
>>> q.view()
Quaternion([ 0.27216553, -0.40824829,  0.54433105, -0.68041382])
>>> q.x
-0.408248290463863

It can also be accessed directly, treating the Quaternion as an array:

>>> q[1]
-0.408248290463863