Post · 1 min read· p. 144

Quaternion.w

Quaternion.w : Scalar part of the Quaternion.

code
Given a quaternion q=(qwqv)=(qwqxqyqz)\mathbf{q}=\begin{pmatrix}q_w & \mathbf{q}_v\end{pmatrix} = \begin{pmatrix}q_w & q_x & q_y & q_z\end{pmatrix},
the scalar part, a.k.a. *real* part, is qwq_w.

Returns:
:   **w** – Scalar part of the quaternion.

Return type:
:   float

Examples

```default

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

q.w 0.2721655269759087

code

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

    ```default
>>> q[0]
0.2721655269759087