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

56 lines
1.2 KiB
Markdown

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