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

57 lines
1.3 KiB
Markdown

# Resetting the state of a Quaternion
[Русская версия / Russian version](reset-rus.md)
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);
```
These functions set all the components of a quaternion to zero.
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;
```
This function is good for setting up the initial state of a quaternion.
### Parameter
| Parameter | Direction | Description |
| ---------- | --------- | ------------------------------------------------------------ |
| quaternion | out | A pointer to a quaternions which components must be set to 0 |
You should pass only valid pointers in the parameter *quaternion*. The NULL (0) value is considered invalid.
### Example
```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)