Переименование s0 -> s, x1 -> x, x2 -> y, x3 -> z, что должно упростить читаемость кода. Также обновление документации
This commit is contained in:
parent
d83ab7160d
commit
b8d383da33
38 changed files with 2104 additions and 2070 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,38 @@
|
|||
# Копирование
|
||||
|
||||
Функции копирования позволяют скопировать значения координат одного вектора в другой вектор.
|
||||
Ôóíêöèè êîïèðîâàíèÿ ïîçâîëÿþò ñêîïèðîâàòü çíà÷åíèÿ êîîðäèíàò îäíîãî âåêòîðà
|
||||
â äðóãîé âåêòîð.
|
||||
|
||||
Функция для **BgcVector3FP32**:
|
||||
Ôóíêöèÿ äëÿ **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);
|
||||
```
|
||||
|
||||
Функция для **BgcVector3FP64**:
|
||||
Ôóíêöèÿ äëÿ **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);
|
||||
```
|
||||
|
||||
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||
|
||||
```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;
|
||||
```
|
||||
|
||||
Параметры **from** и **to** не должны быть некорректными указателями. Значение NULL (0) также считается некорректным.
|
||||
Ïàðàìåòðû **source** è **destination** íå äîëæíû áûòü íåêîððåêòíûìè óêàçàòåëÿìè.
|
||||
Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
|
||||
Параметр **from** должен быть указателем на трёхмерный вектор, координаты которого должны быть скопированы. Координаты вектора **from** не изменятся после вызова функции.
|
||||
Ïàðàìåòð **source** äîëæåí áûòü óêàçàòåëåì íà òð¸õìåðíûé âåêòîð, êîîðäèíàòû
|
||||
êîòîðîãî äîëæíû áûòü ñêîïèðîâàíû. Êîîðäèíàòû âåêòîðà **source** íå èçìåíÿòñÿ
|
||||
ïîñëå âûçîâà ôóíêöèè.
|
||||
|
||||
Параметр **to** должен быть указателем на трёхмерный вектор, координаты которого должны быть изменены. Координаты вектора **to** после вызова функции станут такими же, как и у вектора **from**.
|
||||
Ïàðàìåòð **destination** äîëæåí áûòü óêàçàòåëåì íà òð¸õìåðíûé âåêòîð, êîîðäèíàòû
|
||||
êîòîðîãî äîëæíû áûòü èçìåíåíû. Êîîðäèíàòû âåêòîðà **destination** ïîñëå âûçîâà
|
||||
ôóíêöèè ñòàíóò òàêèìè æå, êàê è ó âåêòîðà **source**.
|
||||
|
||||
Пример применения:
|
||||
|
||||
|
|
@ -36,13 +42,15 @@ to->x3 = from->x3;
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,27 +2,30 @@
|
|||
|
||||
These functions set all coordinates of 3D vectors to 0.
|
||||
|
||||
Function for **BgcVector3FP32**:
|
||||
Function for **BGC_FP32_Vector3**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector3_reset_fp32(BgcVector3FP32* vector);
|
||||
inline void bgc_fp32_vector3_reset(BGC_FP32_Vector3* vector);
|
||||
```
|
||||
|
||||
Function for **BgcVector3FP64**:
|
||||
Function for **BGC_FP64_Vector3**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector3_reset_fp64(BgcVector3FP64* vector);
|
||||
inline void bgc_fp64_vector3_reset(BGC_FP64_Vector3* vector);
|
||||
```
|
||||
|
||||
Each of these functions is equivalent to the following lines of code:
|
||||
|
||||
```c
|
||||
vector->x1 = 0;
|
||||
vector->x2 = 0;
|
||||
vector->x3 = 0;
|
||||
vector->x = 0;
|
||||
vector->y = 0;
|
||||
vector->z = 0;
|
||||
```
|
||||
|
||||
You should not pass invalid pointers to these functions. The NULL (0) value is also considered invalid.
|
||||
You should not pass invalid pointers to these functions. The NULL (0) value is
|
||||
also considered invalid.
|
||||
|
||||
This function is good for setting up the initial state of a 3D vector.
|
||||
|
||||
Example of use:
|
||||
|
||||
|
|
@ -32,11 +35,11 @@ Example of use:
|
|||
|
||||
int main()
|
||||
{
|
||||
BgcVector3FP32 my_vector;
|
||||
BGC_FP32_Vector3 my_vector;
|
||||
|
||||
bgc_vector3_reset_fp32(&my_vector);
|
||||
bgc_fp32_vector3_reset(&my_vector);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,27 +2,30 @@
|
|||
|
||||
Функции устанавливают значение 0 всем координатам трёхмерных векторов.
|
||||
|
||||
Ôóíêöèÿ äëÿ **BgcVector3FP32**:
|
||||
Ôóíêöèÿ äëÿ **BGC_FP32_Vector3**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector3_reset_fp32(BgcVector3FP32* vector);
|
||||
inline void bgc_fp32_vector3_reset(BGC_FP32_Vector3* vector);
|
||||
```
|
||||
|
||||
Ôóíêöèÿ äëÿ **BgcVector3FP64**:
|
||||
Ôóíêöèÿ äëÿ **BGC_FP64_Vector3**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector3_reset_fp64(BgcVector3FP64* vector);
|
||||
inline void bgc_fp64_vector3_reset(BGC_FP64_Vector3* vector);
|
||||
```
|
||||
|
||||
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||
|
||||
```c
|
||||
vector->x1 = 0;
|
||||
vector->x2 = 0;
|
||||
vector->x3 = 0;
|
||||
vector->x = 0;
|
||||
vector->y = 0;
|
||||
vector->z = 0;
|
||||
```
|
||||
|
||||
 äàííûå ôóíêöèè íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
 äàííûå ôóíêöèè íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0)
|
||||
òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
|
||||
Äàííàÿ ôóíêöèÿ õîðîøî ïîäõîäèò äëÿ èíèöèàëèçàöèè íà÷àëüíîãî ñîñòîÿíèÿ âåêòîðà.
|
||||
|
||||
Пример применения:
|
||||
|
||||
|
|
@ -32,11 +35,11 @@ vector->x3 = 0;
|
|||
|
||||
int main()
|
||||
{
|
||||
BgcVector3FP32 my_vector;
|
||||
BGC_FP32_Vector3 my_vector;
|
||||
|
||||
bgc_vector3_reset_fp32(&my_vector);
|
||||
bgc_fp32_vector3_reset(&my_vector);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,35 @@
|
|||
# Задание координат трёхмерного вектора
|
||||
# Указание координат трёхмерного вектора
|
||||
|
||||
Задавать координаты векторов можно как напрямую, так и спомощью функций. Функции задания значений координат позволяют сделать это одной строкой.
|
||||
Указать координаты векторов можно как напрямую, так и спомощью функций.
|
||||
Принципиальной разницы нет, но функции указания координат позволяют сделать это
|
||||
одной строкой.
|
||||
|
||||
Функция для **BgcVector3FP32**:
|
||||
Функция для **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);
|
||||
```
|
||||
|
||||
Функция для **BgcVector3FP32**:
|
||||
Функция для **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);
|
||||
```
|
||||
|
||||
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||
|
||||
```c
|
||||
to->x1 = x1;
|
||||
to->x2 = x2;
|
||||
to->x3 = x3;
|
||||
destination->x = x;
|
||||
destination->y = y;
|
||||
destination->z = z;
|
||||
```
|
||||
|
||||
В параметре **to** не следует передавать некорректные указатели. Значение NULL (0) также считается некорректным.
|
||||
В параметре **destination** не следует передавать некорректные указатели.
|
||||
Значение NULL (0) также считается некорректным.
|
||||
|
||||
Данная функция хорошо подходит для заданя значений координат вектора одной
|
||||
строкой. Особенно если надо указать фиксированные значения координат как
|
||||
в примере ниже.
|
||||
|
||||
Пример применения:
|
||||
|
||||
|
|
@ -32,11 +39,11 @@ to->x3 = x3;
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# Обмен
|
||||
# Обмен значениями
|
||||
|
||||
Функции обмена позволяют двум векторам одного типа обменяться значениями координат.
|
||||
Функции обмена позволяют двум векторам одного типа обменяться значениями
|
||||
координат.
|
||||
|
||||
Функция для **BgcVector3FP32**:
|
||||
|
||||
|
|
@ -14,11 +15,14 @@ inline void bgc_vector3_swap_fp32(BgcVector3FP32* vector1, BgcVector3FP32* vecto
|
|||
inline void bgc_vector3_swap_fp64(BgcVector3FP64* vector1, BgcVector3FP64* vector2);
|
||||
```
|
||||
|
||||
Параметры **vector1** и **vector2** не должны быть некорректными указателями. Значение NULL (0) также считается некорректным.
|
||||
Параметры **vector1** и **vector2** не должны быть некорректными указателями.
|
||||
Значение NULL (0) также считается некорректным.
|
||||
|
||||
Вектор **vector1** после вызова данной функции будет иметь значения координат, какие имел вектор **vector2** до вызова функции.
|
||||
Вектор **vector1** после вызова данной функции будет иметь значения координат,
|
||||
какие имел вектор **vector2** до вызова функции.
|
||||
|
||||
А вектор **vector2** после вызова данной функции будет иметь такие же значения координат, какие имел вектор **vector1** до вызова функции.
|
||||
А вектор **vector2** после вызова данной функции будет иметь такие же значения
|
||||
координат, какие имел вектор **vector1** до вызова функции.
|
||||
|
||||
Пример применения:
|
||||
|
||||
|
|
@ -28,15 +32,15 @@ inline void bgc_vector3_swap_fp64(BgcVector3FP64* vector1, BgcVector3FP64* vecto
|
|||
|
||||
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()
|
|||
Результат:
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
[Документация](../intro-rus.md) / [3D векторы](../vector3-rus.md)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue