Quaternion

type

quaternion64 quaternion128 quaternion256
  • Type Conversion .

    • fN               -> quaternion4N  (e.g. f32  -> quaternion128 )

    • complex2N  -> quaternion4N  (e.g. complex64  -> quaternion128 )

Interpretation

  • "It's a bit odd that the value is an operation. It's just a very mathematical  approach to it. It's basically an extension of how complex numbers are written mathematically, e.g., 1 + 2i ".

  • "It's more just syntax sugar for setting its fields, I think".

rot: quaternion128 = quaternion(x=0, y=0, z=0, w=1)  // arguments must be named, to avoid ambiguity

rot: quaternion128 = 1 + 0i + 0j + 0k                // this is valid.
  • rot: quaternion128 = 1 , same as 1 + 0i + 0j + 0k .

    • This is the identity quaternion.

  • rot: quaternion128 = 0 , same as 0 + 0i + 0j + 0k .

Procedures