Обновление документации по векторам и кватернионам
This commit is contained in:
parent
2fd2578bb3
commit
460fe94830
20 changed files with 237 additions and 138 deletions
|
|
@ -1,24 +1,32 @@
|
|||
# Swapping
|
||||
|
||||
The exchange functions allow two vectors of the same type to exchange coordinate values.
|
||||
[Русская версия / Russian version](swap-rus.md)
|
||||
|
||||
Function for **BgcVector2FP32**:
|
||||
set-values-rus.md
|
||||
|
||||
The exchange functions allow two vectors of the same type to exchange coordinate
|
||||
values.
|
||||
|
||||
Function for **BGC_FP32_Vector2**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_swap_fp32(BgcVector2FP32* vector1, BgcVector2FP32* vector2);
|
||||
inline void bgc_fp32_vector2_swap(BGC_FP32_Vector2* const vector1, BGC_FP32_Vector2* const vector2);
|
||||
```
|
||||
|
||||
Function for **BgcVector2FP32**:
|
||||
Function for **BGC_FP64_Vector2**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_swap_fp64(BgcVector2FP64* vector1, BgcVector2FP64* vector2);
|
||||
inline void bgc_fp64_vector2_swap(BGC_FP64_Vector2* const vector1, BGC_FP64_Vector2* 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 **vector2** had before calling the function.
|
||||
Vector **vector1** after calling this function will have the coordinate values
|
||||
that vector **vector2** had before calling the function.
|
||||
|
||||
And vector **vector2** after calling this function will have the same coordinate values that vector **vector1** had before calling the function.
|
||||
And vector **vector2** after calling this function will have the same coordinate
|
||||
values that vector **vector1** had before calling the function.
|
||||
|
||||
Example of use:
|
||||
|
||||
|
|
@ -28,15 +36,16 @@ Example of use:
|
|||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
BGC_FP32_Vector2 my_vector1, my_vector2;
|
||||
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
|
||||
bgc_vector2_set_values_fp32(10, -1, &my_vector2);
|
||||
|
||||
bgc_vector2_swap_fp32(&my_vector1, &my_vector2);
|
||||
bgc_fp32_vector2_set_values(&my_vector1, -2, 7);
|
||||
bgc_fp32_vector2_set_values(&my_vector2, 10, -1);
|
||||
|
||||
printf("Vector #1: x1 = %f, x2 = %f\n", my_vector1.x1, my_vector1.x2);
|
||||
printf("Vector #2: x1 = %f, x2 = %f\n", my_vector2.x1, my_vector2.x2);
|
||||
bgc_fp32_vector2_swap(&my_vector1, &my_vector2);
|
||||
|
||||
printf("Vector #1: x = %f, y = %f\n", my_vector1.x, my_vector1.y);
|
||||
printf("Vector #2: x = %f, y = %f\n", my_vector2.x, my_vector2.y);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue