Переименование s0 -> s, x1 -> x, x2 -> y, x3 -> z, что должно упростить читаемость кода. Также обновление документации

This commit is contained in:
Andrey Pokidov 2026-03-29 22:06:01 +07:00
parent d83ab7160d
commit b8d383da33
38 changed files with 2104 additions and 2070 deletions

View file

@ -1,28 +1,34 @@
# Setting the coordinates of a three-dimensional vector
You can set the coordinates of vectors either directly or using functions. The functions for setting coordinate values allow you to do this in one line.
You can set the coordinates of vectors either directly or using functions.
The functions for setting coordinate values allow you to do this in one line.
Function for **BgcVector3FP32**:
Function for **BGC_FP32_Vector3**:
```c
inline void bgc_vector3_set_values_fp32(const float x1, const float x2, const float x3, BgcVector3FP32* to);
inline void bgc_fp32_vector3_set_values(BGC_FP32_Vector3* const destination, const float x, const float y, const float z);
```
Function for **BgcVector3FP32**:
Function for **BGC_FP64_Vector3**:
```c
inline void bgc_vector3_set_values_fp64(const double x1, const double x2, const double x3, BgcVector3FP64* to);
inline void bgc_fp64_vector3_set_values(BGC_FP64_Vector3* const destination, const double x, const double y, const double z);
```
Each of these functions is equivalent to the following lines of code:
```c
to->x1 = x1;
to->x2 = x2;
to->x3 = x3;
destination->x = x;
destination->y = y;
destination->z = z;
```
Invalid pointers should not be passed in the **to** parameter. The NULL (0) value is also considered invalid.
Invalid pointers should not be passed in the **destination** parameter.
The NULL (0) value is also considered invalid.
This function is good for setting up the initial values of coordinates with
one-line especially when the values are fixed constants like in the example
below.
Example of use:
@ -32,11 +38,11 @@ Example of use:
int main()
{
BgcVector3FP32 my_vector;
BGC_FP32_Vector3 my_vector;
bgc_vector3_set_values_fp32(-2, 7, 10, &my_vector);
bgc_fp32_vector3_set_values(&my_vector, -2.2f, 7.1f, 10.01f);
printf("x1 = %f, x2 = %f, x3 = %f\n", my_vector.x1, my_vector.x2, my_vector.x3);
printf("x = %f, y = %f, z = %f\n", my_vector.x, my_vector.y, my_vector.z);
return 0;
}