bgc-c/docs/quaternion-eng.md

44 lines
1.3 KiB
Markdown

# Quaternions
[Ðóññêàÿ âåðñèÿ / Russian version](quaternion-rus.md)
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:
- i<sup>2</sup> = j<sup>2</sup> = k<sup>2</sup> = 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:
```c
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](intro-eng.md)