50 lines
1,014 B
Markdown
50 lines
1,014 B
Markdown
# Resetting the state of a 3D vector
|
|
|
|
[Русская версия / Russian version](reset-rus.md)
|
|
|
|
These functions set all coordinates of 3D vectors to 0.
|
|
|
|
Function for **BGC_FP32_Vector3**:
|
|
|
|
```c
|
|
inline void bgc_fp32_vector3_reset(BGC_FP32_Vector3* const vector);
|
|
```
|
|
|
|
Function for **BGC_FP64_Vector3**:
|
|
|
|
```c
|
|
inline void bgc_fp64_vector3_reset(BGC_FP64_Vector3* const vector);
|
|
```
|
|
|
|
Each of these functions is equivalent to the following lines of code:
|
|
|
|
```c
|
|
vector->x = 0;
|
|
vector->y = 0;
|
|
vector->z = 0;
|
|
```
|
|
|
|
You should not pass invalid pointers to these functions. The NULL (0) value is
|
|
also considered invalid.
|
|
|
|
This function is good for setting up the initial state of a 3D vector.
|
|
|
|
Example of use:
|
|
|
|
```c
|
|
#include <stdio.h>
|
|
#include <basic-geometry.h>
|
|
|
|
int main()
|
|
{
|
|
BGC_FP32_Vector3 my_vector;
|
|
|
|
bgc_fp32_vector3_reset(&my_vector);
|
|
|
|
printf("x = %f, y = %f, z = %f\n", my_vector.x, my_vector.y, my_vector.z);
|
|
|
|
return 0;
|
|
}
|
|
```
|
|
|
|
[Documentation](../intro-eng.md) / [3D vectors](../vector3-eng.md)
|