bgc-c/docs/quaternion-eng.md

1.3 KiB

Quaternions

Русская версия / Russian version

Quaternions are hypercomplex numbers that extend the concept of complex numbers. They consist of one real component and three imaginary components:

q = s + ix + jy + kz

where:

  • s, x, y, z ∈ R are real numbers
  • i, j, k are imaginary units that satisfy the following conditions:
    • i2 = j2 = k2 = ijk = -1

Quaternions were discovered by mathematician William Hamilton and introduced to the public in 1843. They have found wide application in computer graphics, robotics, and physics to describe rotations in three-dimensional space.

Quaternion implementation in the library

There are two types of quaternions in the library:

  • BGC_FP32_Quaternion - a quaternion using single-precision floating-point numbers
  • BGC_FP64_Quaternion - a quaternion using double-precision floating-point numbers

Structure definitions:

    typedef struct {
        float s, x, y, z;
    } BGC_FP32_Quaternion;

    typedef struct {
        double s, x, y, z;
    } BGC_FP64_Quaternion;

Fields:

  • s is the real part of the quaternion. It is named after the word "scalar".
  • x, y, z - Imaginary components of the quaternion.

Documentation