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

972 B

Resetting the state of a 2D vector

Русская версия / Russian version

These functions set all coordinates of 2D vectors to 0.

Function for BGC_FP32_Vector2:

inline void bgc_fp32_vector2_reset(BGC_FP32_Vector2* const vector);

Function for BGC_FP64_Vector2:

inline void bgc_fp64_vector2_reset(BGC_FP64_Vector2* const vector);

Each of these functions is equivalent to the following lines of code:

vector->x = 0;
vector->y = 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 2D vector.

Example of use:

#include <stdio.h>
#include <basic-geometry.h>

int main()
{
    BGC_FP32_Vector2 my_vector;

    bgc_fp32_vector2_reset(&my_vector);

    printf("x = %f, y = %f\n", my_vector.x, my_vector.y);

    return 0;
}

Documentation / 2D vectors