Переименование 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,24 +1,28 @@
# Swapping
The exchange functions allow two vectors of the same type to exchange coordinate values.
The exchange functions allow two vectors of the same type to exchange coordinate
values.
Function for **BgcVector3FP32**:
Function for **BGC_FP32_Vector3**:
```c
inline void bgc_vector3_swap_fp32(BgcVector3FP32* vector1, BgcVector3FP32* vector2);
inline void bgc_fp32_vector3_swap(BGC_FP32_Vector3* const vector1, BGC_FP32_Vector3* const vector2);
```
Function for **BgcVector3FP32**:
Function for **BGC_FP64_Vector3**:
```c
inline void bgc_vector3_swap_fp64(BgcVector3FP64* vector1, BgcVector3FP64* vector2);
inline void bgc_fp64_vector3_swap(BGC_FP64_Vector3* const vector1, BGC_FP64_Vector3* const vector2);
```
The **vector1** and **vector2** parameters must not be invalid pointers. The NULL (0) value is also considered invalid.
The **vector1** and **vector2** parameters must be valid pointers.
The NULL (0) value is considered invalid.
Vector **vector1** after calling this function will have the coordinate values that vector **vector3** had before calling the function.
Vector **vector1** after calling this function will have the coordinate values
that vector **vector3** had before calling the function.
And vector **vector3** after calling this function will have the same coordinate values that vector **vector1** had before calling the function.
And vector **vector3** after calling this function will have the same coordinate
values that vector **vector1** had before calling the function.
Example of use:
@ -28,15 +32,15 @@ Example of use:
int main()
{
BgcVector3FP32 my_vector1, my_vector2;
BGC_FP32_Vector3 my_vector1, my_vector2;
bgc_vector3_set_values_fp32(-2, 7, 5, &my_vector1);
bgc_vector3_set_values_fp32(10, -1, -3, &my_vector2);
bgc_fp32_vector3_set_values(&my_vector1, -2, 7, 5);
bgc_fp32_vector3_set_values(&my_vector2, 10, -1, -3);
bgc_vector3_swap_fp32(&my_vector1, &my_vector2);
bgc_fp32_vector3_swap(&my_vector1, &my_vector2);
printf("Vector #1: x1 = %f, x2 = %f, x3 = %f\n", my_vector1.x1, my_vector1.x2, my_vector1.x3);
printf("Vector #2: x1 = %f, x2 = %f, x3 = %f\n", my_vector2.x1, my_vector2.x2, my_vector2.x3);
printf("Vector #1: x = %f, y = %f, z = %f\n", my_vector1.x, my_vector1.y, my_vector1.z);
printf("Vector #2: x = %f, y = %f, z = %f\n", my_vector2.x, my_vector2.y, my_vector2.z);
return 0;
}
@ -45,8 +49,8 @@ int main()
Result:
```
Vector #1: x1 = 10.000000, x2 = -1.000000, x3 = -3.000000
Vector #2: x1 = -2.000000, x2 = 7.000000, x3 = 5.000000
Vector #1: x = 10.000000, y = -1.000000, z = -3.000000
Vector #2: x = -2.000000, y = 7.000000, z = 5.000000
```
[Documentation](../intro-eng.md) / [3D vectors](../vector3-eng.md)