Переименование 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,32 +1,39 @@
# Copying
The copy functions allow you to copy the coordinate values of one vector to another vector.
The copy functions allow you to copy the coordinate values of one vector
to another vector.
Function for **BgcVector3FP32**:
Function for **BGC_FP32_Vector3**:
```c
inline void bgc_vector3_copy_fp32(const BgcVector3FP32* from, BgcVector3FP32* to);
inline void bgc_fp32_vector3_copy(BGC_FP32_Vector3* const destination, const BGC_FP32_Vector3* const source);
```
Function for **BgcVector3FP64**:
Function for **BGC_FP64_Vector3**:
```c
inline void bgc_vector3_copy_fp64(const BgcVector3FP64* from, BgcVector3FP64* to);
inline void bgc_fp64_vector3_copy(BGC_FP64_Vector3* const destination, const BGC_FP64_Vector3* const source);
```
Each of these functions is equivalent to the following lines of code:
```c
to->x1 = from->x1;
to->x2 = from->x2;
to->x3 = from->x3;
destination->x = source->x;
destination->y = source->y;
destination->z = source->z;
```
The **from** and **to** parameters must not be invalid pointers. The NULL (0) value is also considered invalid.
The **source** and **destination** parameters must not be invalid pointers.
The NULL (0) value is also considered invalid.
The **from** parameter must be a pointer to a three-dimensional vector whose coordinates are to be copied. The coordinates of the **from** vector will not change after the function call.
The **source** parameter must be a pointer to a three-dimensional vector whose
coordinates are to be copied. The coordinates of the **source** vector will
not change after the function call.
The **to** parameter must be a pointer to a three-dimensional vector whose coordinates are to be changed. The coordinates of the **to** vector will become the same as those of the **from** vector after the function call.
The **destination** parameter must be a pointer to a three-dimensional vector
whose coordinates are to be changed. The coordinates of the **destination**
vector will become the same as those of the **source** vector after the function
call.
Example of use:
@ -36,13 +43,15 @@ Example of use:
int main()
{
BgcVector3FP32 my_vector1, my_vector3;
BGC_FP32_Vector3 my_vector1, my_vector2;
bgc_vector3_set_values_fp32(-2, 7, 1, &my_vector1);
my_vector1.x = -2.0f;
my_vector1.y = 7.4f;
my_vector1.z = 1.8f;
bgc_vector3_copy_fp32(&my_vector1, &my_vector3);
bgc_fp32_vector3_copy(&my_vector2, &my_vector1);
printf("x1 = %f, x2 = %f, x3 = %f\n", my_vector3.x1, my_vector3.x2, my_vector3.x3);
printf("x = %f, y = %f, z = %f\n", my_vector2.x, my_vector2.y, my_vector2.z);
return 0;
}