bgc-c/docs/quaternion/reset-eng.md

51 lines
1 KiB
Markdown

# Resetting the state of a Quaternion
[Русская версия / Russian version](reset-rus.md)
These functions set all parts of a quaternion to 0.
Function for **BGC_FP32_Quaternion**:
```c
inline void bgc_fp32_quaternion_reset(BGC_FP32_Quaternion* const quaternion);
```
Function for **BGC_FP64_Quaternion**:
```c
inline void bgc_fp64_quaternion_reset(BGC_FP64_Quaternion* const quaternion);
```
Each of these functions is equivalent to the following lines of code:
```c
vector->s = 0;
vector->x = 0;
vector->y = 0;
vector->z = 0;
```
You should pass valid pointers to these functions. The NULL (0) value is also
considered invalid.
This function is good for setting up the initial state of a quaternion.
Example of use:
```c
#include <stdio.h>
#include <basic-geometry.h>
int main()
{
BGC_FP64_Quaternion q;
bgc_fp64_quaternion_reset(&q);
printf("s = %lf, x = %lf, y = %lf, z = %lf\n", q.s, q.x, q.y, q.z);
return 0;
}
```
[Documentation](../intro-eng.md) / [Quaternions](../quaternion-eng.md)