Улучшение читаемости примеров для векторов, добавление описания функций copy и swap для кватернионов
This commit is contained in:
parent
cc3ce1f327
commit
f402f68516
22 changed files with 325 additions and 77 deletions
63
docs/quaternion/copy-eng.md
Normal file
63
docs/quaternion/copy-eng.md
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
# Copying
|
||||||
|
|
||||||
|
[Русская версия / Russian version](copy-rus.md)
|
||||||
|
|
||||||
|
The copy functions allow you to copy the component values of one quaternion
|
||||||
|
to another quaternion.
|
||||||
|
|
||||||
|
Function for **BGC_FP32_Quaternion**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
inline void bgc_fp32_quaternion_copy(BGC_FP32_Quaternion* const destination, const BGC_FP32_Quaternion* const source);
|
||||||
|
```
|
||||||
|
|
||||||
|
Function for **BGC_FP64_Quaternion**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
inline void bgc_fp64_quaternion_copy(BGC_FP64_Quaternion* const destination, const BGC_FP64_Quaternion* const source);
|
||||||
|
```
|
||||||
|
|
||||||
|
Each of these functions is equivalent to the following lines of code:
|
||||||
|
|
||||||
|
```c
|
||||||
|
destination->s = source->s;
|
||||||
|
destination->x = source->x;
|
||||||
|
destination->y = source->y;
|
||||||
|
destination->z = source->z;
|
||||||
|
```
|
||||||
|
|
||||||
|
The **source** and **destination** parameters must not be invalid pointers.
|
||||||
|
The NULL (0) value is also considered invalid.
|
||||||
|
|
||||||
|
The **source** parameter must be a pointer to a quaternion which components
|
||||||
|
are to be copied. The coordinates of the **source** quaternion will
|
||||||
|
not change after the function call.
|
||||||
|
|
||||||
|
The **destination** parameter must be a pointer to a quaternion which components
|
||||||
|
are to be changed. The coordinates of the **destination** quaternion will become
|
||||||
|
the same as those of the **source** quaternion after the function call.
|
||||||
|
|
||||||
|
Example of use:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <basic-geometry.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BGC_FP32_Quaternion q1, q2;
|
||||||
|
|
||||||
|
q1.s = 1.1f;
|
||||||
|
q1.x = -2.0f;
|
||||||
|
q1.y = 7.4f;
|
||||||
|
q1.z = 1.8f;
|
||||||
|
|
||||||
|
bgc_fp32_quaternion_copy(&q2, &q1);
|
||||||
|
|
||||||
|
printf("s = %f, x = %f, y = %f, z = %f\n", q2.s, q2.x, q2.y, q2.z);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
[Documentation](../intro-eng.md) / [Quaternions](../quaternion-eng.md)
|
||||||
63
docs/quaternion/copy-rus.md
Normal file
63
docs/quaternion/copy-rus.md
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
# Копирование
|
||||||
|
|
||||||
|
[English version / Английская версия](copy-eng.md)
|
||||||
|
|
||||||
|
Функции копирования позволяют скопировать значения компонент одного кватерниона
|
||||||
|
в другой кватернион.
|
||||||
|
|
||||||
|
Функция для **BGC_FP32_Quaternion**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
inline void bgc_fp32_quaternion_copy(BGC_FP32_Quaternion* const destination, const BGC_FP32_Quaternion* const source);
|
||||||
|
```
|
||||||
|
|
||||||
|
Функция для **BGC_FP64_Quaternion**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
inline void bgc_fp64_quaternion_copy(BGC_FP64_Quaternion* const destination, const BGC_FP64_Quaternion* const source);
|
||||||
|
```
|
||||||
|
|
||||||
|
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||||
|
|
||||||
|
```c
|
||||||
|
destination->s = source->s;
|
||||||
|
destination->x = source->x;
|
||||||
|
destination->y = source->y;
|
||||||
|
destination->z = source->z;
|
||||||
|
```
|
||||||
|
|
||||||
|
Параметры **source** и **destination** должны быть корректными указателями.
|
||||||
|
Значение NULL (0) также считается некорректным.
|
||||||
|
|
||||||
|
Параметр **source** должен быть указателем на кватернион, компоненты которого
|
||||||
|
должны быть скопированы. Компоненты кватерниона **source** не изменятся после
|
||||||
|
вызова функции.
|
||||||
|
|
||||||
|
Параметр **destination** должен быть указателем на кватернионы, компоненты
|
||||||
|
которого должны быть изменены. Координаты кватерниона **destination** после
|
||||||
|
вызова функции станут такими же, как и у кватерниона **source**.
|
||||||
|
|
||||||
|
Пример применения:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <basic-geometry.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BGC_FP32_Quaternion q1, q2;
|
||||||
|
|
||||||
|
q1.s = 1.1f;
|
||||||
|
q1.x = -2.0f;
|
||||||
|
q1.y = 7.4f;
|
||||||
|
q1.z = 1.8f;
|
||||||
|
|
||||||
|
bgc_fp32_quaternion_copy(&q2, &q1);
|
||||||
|
|
||||||
|
printf("s = %f, x = %f, y = %f, z = %f\n", q2.s, q2.x, q2.y, q2.z);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
[Документация](../intro-rus.md) / [Кватернионы](../quaternion-rus.md)
|
||||||
|
|
@ -19,8 +19,10 @@ inline void bgc_fp64_quaternion_reset(BGC_FP64_Quaternion* const quaternion);
|
||||||
Each of these functions is equivalent to the following lines of code:
|
Each of these functions is equivalent to the following lines of code:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
|
vector->s = 0;
|
||||||
vector->x = 0;
|
vector->x = 0;
|
||||||
vector->y = 0;
|
vector->y = 0;
|
||||||
|
vector->z = 0;
|
||||||
```
|
```
|
||||||
|
|
||||||
You should pass valid pointers to these functions. The NULL (0) value is also
|
You should pass valid pointers to these functions. The NULL (0) value is also
|
||||||
|
|
@ -36,14 +38,14 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP64_Quaternion quaternion;
|
BGC_FP64_Quaternion q;
|
||||||
|
|
||||||
bgc_fp32_quaternion_reset(&quaternion);
|
bgc_fp64_quaternion_reset(&q);
|
||||||
|
|
||||||
printf("s = %lf, x = %lf, y = %lf, z = %lf\n", quaternion.s, quaternion.x, quaternion.y, quaternion.z);
|
printf("s = %lf, x = %lf, y = %lf, z = %lf\n", q.s, q.x, q.y, q.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
[Documentation](../intro-eng.md) / [2D vectors](../quaternion-eng.md)
|
[Documentation](../intro-eng.md) / [Quaternions](../quaternion-eng.md)
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,10 @@ inline void bgc_fp64_quaternion_reset(BGC_FP64_Quaternion* const quaternion);
|
||||||
Каждая из данных функции эквивалентна следующим строкам кода:
|
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
|
vector->s = 0;
|
||||||
vector->x = 0;
|
vector->x = 0;
|
||||||
vector->y = 0;
|
vector->y = 0;
|
||||||
|
vector->z = 0;
|
||||||
```
|
```
|
||||||
|
|
||||||
В параметре **quaternion** следует передавать корректный указатель на
|
В параметре **quaternion** следует передавать корректный указатель на
|
||||||
|
|
@ -37,11 +39,11 @@ vector->y = 0;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP64_Quaternion quaternion;
|
BGC_FP64_Quaternion q;
|
||||||
|
|
||||||
bgc_fp32_quaternion_reset(&quaternion);
|
bgc_fp64_quaternion_reset(&q);
|
||||||
|
|
||||||
printf("s = %lf, x = %lf, y = %lf, z = %lf\n", quaternion.s, quaternion.x, quaternion.y, quaternion.z);
|
printf("s = %lf, x = %lf, y = %lf, z = %lf\n", q.s, q.x, q.y, q.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
60
docs/quaternion/swap-eng.md
Normal file
60
docs/quaternion/swap-eng.md
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
# Swapping
|
||||||
|
|
||||||
|
[Русская версия / Russian version](swap-rus.md)
|
||||||
|
|
||||||
|
The exchange functions allow two quaternions of the same type to exchange
|
||||||
|
component values.
|
||||||
|
|
||||||
|
Function for **BGC_FP32_Quaternion**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
inline void bgc_fp32_quaternion_swap(BGC_FP32_Quaternion* const quarternion1, BGC_FP32_Quaternion* const quarternion2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Function for **BGC_FP64_Quaternion**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
inline void bgc_fp64_quaternion_swap(BGC_FP64_Quaternion* const quarternion1, BGC_FP64_Quaternion* const quarternion2);
|
||||||
|
```
|
||||||
|
|
||||||
|
The **quarternion1** and **quarternion2** parameters must be valid pointers.
|
||||||
|
The NULL (0) value is considered invalid.
|
||||||
|
|
||||||
|
The quaternion **quarternion1** after calling this function will have the same
|
||||||
|
component values the quaternion **quarternion2** had before calling
|
||||||
|
the function.
|
||||||
|
|
||||||
|
And the quaternion **quarternion2** after calling this function will have
|
||||||
|
the same compnent values the quaternion **quarternion1** had before calling
|
||||||
|
the function.
|
||||||
|
|
||||||
|
Example of use:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <basic-geometry.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BGC_FP32_Quaternion q1, q2;
|
||||||
|
|
||||||
|
bgc_fp32_quaternion_set_values(&q1, 4, -2, 7, 5);
|
||||||
|
bgc_fp32_quaternion_set_values(&q2, -5, 10, -1, -3);
|
||||||
|
|
||||||
|
bgc_fp32_quaternion_swap(&q1, &q2);
|
||||||
|
|
||||||
|
printf("Quaternion #1: s = %f, x = %f, y = %f, z = %f\n", q1.s, q1.x, q1.y, q1.z);
|
||||||
|
printf("Quaternion #2: s = %f, x = %f, y = %f, z = %f\n", q2.s, q2.x, q2.y, q2.z);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The console output:
|
||||||
|
|
||||||
|
```
|
||||||
|
Quaternion #1: s = -5.000000, x = 10.000000, y = -1.000000, z = -3.000000
|
||||||
|
Quaternion #2: s = 4.000000, x = -2.000000, y = 7.000000, z = 5.000000
|
||||||
|
```
|
||||||
|
|
||||||
|
[Documentation](../intro-eng.md) / [Quaternions](../quaternion-eng.md)
|
||||||
58
docs/quaternion/swap-rus.md
Normal file
58
docs/quaternion/swap-rus.md
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
# Обмен значениями
|
||||||
|
|
||||||
|
[English version / Английская версия](swap-eng.md)
|
||||||
|
|
||||||
|
Функции обмена позволяют двум кватернионам одного типа обменяться значениями
|
||||||
|
координат.
|
||||||
|
|
||||||
|
Функция для **BGC_FP32_Quaternion**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
inline void bgc_fp32_quaternion_swap(BGC_FP32_Quaternion* const quarternion1, BGC_FP32_Quaternion* const quarternion2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Функция для **BGC_FP64_Quaternion**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
inline void bgc_fp64_quaternion_swap(BGC_FP64_Quaternion* const quarternion1, BGC_FP64_Quaternion* const quarternion2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Параметры **quarternion1** и **quarternion2** должны быть корректными
|
||||||
|
указателями. Значение NULL (0) также считается некорректным.
|
||||||
|
|
||||||
|
Кватернион **quarternion1** после вызова данной функции будет иметь значения
|
||||||
|
компонент такие же, какие имел кватернион **quarternion2** до вызова функции.
|
||||||
|
|
||||||
|
А кватернион **quarternion2** после вызова данной функции будет иметь такие же
|
||||||
|
значения компонет, какие имел кватернион **quarternion1** до вызова функции.
|
||||||
|
|
||||||
|
Пример применения:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <basic-geometry.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BGC_FP32_Quaternion q1, q2;
|
||||||
|
|
||||||
|
bgc_fp32_quaternion_set_values(&q1, 4, -2, 7, 5);
|
||||||
|
bgc_fp32_quaternion_set_values(&q2, -5, 10, -1, -3);
|
||||||
|
|
||||||
|
bgc_fp32_quaternion_swap(&q1, &q2);
|
||||||
|
|
||||||
|
printf("Quaternion #1: s = %f, x = %f, y = %f, z = %f\n", q1.s, q1.x, q1.y, q1.z);
|
||||||
|
printf("Quaternion #2: s = %f, x = %f, y = %f, z = %f\n", q2.s, q2.x, q2.y, q2.z);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Вывод в консоль:
|
||||||
|
|
||||||
|
```
|
||||||
|
Quaternion #1: s = -5.000000, x = 10.000000, y = -1.000000, z = -3.000000
|
||||||
|
Quaternion #2: s = 4.000000, x = -2.000000, y = 7.000000, z = 5.000000
|
||||||
|
```
|
||||||
|
|
||||||
|
[Документация](../intro-rus.md) / [Кватернионы](../quaternion-rus.md)
|
||||||
|
|
@ -43,14 +43,14 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector2 my_vector1, my_vector2;
|
BGC_FP32_Vector2 v1, v2;
|
||||||
|
|
||||||
my_vector1.x = -2.0f;
|
v1.x = -2.0f;
|
||||||
my_vector1.y = 7.4f;
|
v1.y = 7.4f;
|
||||||
|
|
||||||
bgc_fp32_vector2_copy(&my_vector2, &my_vector1);
|
bgc_fp32_vector2_copy(&v2, &v1);
|
||||||
|
|
||||||
printf("x = %f, y = %f\n", my_vector2.x, my_vector2.y);
|
printf("x = %f, y = %f\n", v2.x, v2.y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,14 @@ destination->y = source->y;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector2 my_vector1, my_vector2;
|
BGC_FP32_Vector2 v1, v2;
|
||||||
|
|
||||||
my_vector1.x = -2.0f;
|
v1.x = -2.0f;
|
||||||
my_vector1.y = 7.4f;
|
v1.y = 7.4f;
|
||||||
|
|
||||||
bgc_fp32_vector2_copy(&my_vector2, &my_vector1);
|
bgc_fp32_vector2_copy(&v2, &v1);
|
||||||
|
|
||||||
printf("x = %f, y = %f\n", my_vector2.x, my_vector2.y);
|
printf("x = %f, y = %f\n", v2.x, v2.y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,11 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector2 my_vector;
|
BGC_FP32_Vector2 v;
|
||||||
|
|
||||||
bgc_fp32_vector2_reset(&my_vector);
|
bgc_fp32_vector2_reset(&v);
|
||||||
|
|
||||||
printf("x = %f, y = %f\n", my_vector.x, my_vector.y);
|
printf("x = %f, y = %f\n", v.x, v.y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,11 @@ NULL (0) также считается некорректным.
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector2 my_vector;
|
BGC_FP32_Vector2 v;
|
||||||
|
|
||||||
bgc_fp32_vector2_reset(&my_vector);
|
bgc_fp32_vector2_reset(&v);
|
||||||
|
|
||||||
printf("x = %f, y = %f\n", my_vector.x, my_vector.y);
|
printf("x = %f, y = %f\n", v.x, v.y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,11 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector2 my_vector;
|
BGC_FP32_Vector2 v;
|
||||||
|
|
||||||
bgc_fp32_vector2_set_values(&my_vector, -2.2f, 7.1f);
|
bgc_fp32_vector2_set_values(&v, -2.2f, 7.1f);
|
||||||
|
|
||||||
printf("x = %f, y = %f\n", my_vector.x, my_vector.y);
|
printf("x = %f, y = %f\n", v.x, v.y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,11 @@ destination->y = y;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector2 my_vector;
|
BGC_FP32_Vector2 v;
|
||||||
|
|
||||||
bgc_fp32_vector2_set_values(&my_vector, -2.2f, 7.1f);
|
bgc_fp32_vector2_set_values(&v, -2.2f, 7.1f);
|
||||||
|
|
||||||
printf("x = %f, y = %f\n", my_vector.x, my_vector.y);
|
printf("x = %f, y = %f\n", v.x, v.y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,16 +36,16 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector2 my_vector1, my_vector2;
|
BGC_FP32_Vector2 v1, v2;
|
||||||
|
|
||||||
|
|
||||||
bgc_fp32_vector2_set_values(&my_vector1, -2, 7);
|
bgc_fp32_vector2_set_values(&v1, -2, 7);
|
||||||
bgc_fp32_vector2_set_values(&my_vector2, 10, -1);
|
bgc_fp32_vector2_set_values(&v2, 10, -1);
|
||||||
|
|
||||||
bgc_fp32_vector2_swap(&my_vector1, &my_vector2);
|
bgc_fp32_vector2_swap(&v1, &v2);
|
||||||
|
|
||||||
printf("Vector #1: x = %f, y = %f\n", my_vector1.x, my_vector1.y);
|
printf("Vector #1: x = %f, y = %f\n", v1.x, v1.y);
|
||||||
printf("Vector #2: x = %f, y = %f\n", my_vector2.x, my_vector2.y);
|
printf("Vector #2: x = %f, y = %f\n", v2.x, v2.y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,16 +34,16 @@ inline void bgc_fp64_vector2_swap(BGC_FP64_Vector2* const vector1, BGC_FP64_Vect
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector2 my_vector1, my_vector2;
|
BGC_FP32_Vector2 v1, v2;
|
||||||
|
|
||||||
|
|
||||||
bgc_fp32_vector2_set_values(&my_vector1, -2, 7);
|
bgc_fp32_vector2_set_values(&v1, -2, 7);
|
||||||
bgc_fp32_vector2_set_values(&my_vector2, 10, -1);
|
bgc_fp32_vector2_set_values(&v2, 10, -1);
|
||||||
|
|
||||||
bgc_fp32_vector2_swap(&my_vector1, &my_vector2);
|
bgc_fp32_vector2_swap(&v1, &v2);
|
||||||
|
|
||||||
printf("Vector #1: x = %f, y = %f\n", my_vector1.x, my_vector1.y);
|
printf("Vector #1: x = %f, y = %f\n", v1.x, v1.y);
|
||||||
printf("Vector #2: x = %f, y = %f\n", my_vector2.x, my_vector2.y);
|
printf("Vector #2: x = %f, y = %f\n", v2.x, v2.y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,15 +45,15 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector3 my_vector1, my_vector2;
|
BGC_FP32_Vector3 v1, v2;
|
||||||
|
|
||||||
my_vector1.x = -2.0f;
|
v1.x = -2.0f;
|
||||||
my_vector1.y = 7.4f;
|
v1.y = 7.4f;
|
||||||
my_vector1.z = 1.8f;
|
v1.z = 1.8f;
|
||||||
|
|
||||||
bgc_fp32_vector3_copy(&my_vector2, &my_vector1);
|
bgc_fp32_vector3_copy(&v2, &v1);
|
||||||
|
|
||||||
printf("x = %f, y = %f, z = %f\n", my_vector2.x, my_vector2.y, my_vector2.z);
|
printf("x = %f, y = %f, z = %f\n", v2.x, v2.y, v2.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,15 +44,15 @@ destination->z = source->z;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector3 my_vector1, my_vector2;
|
BGC_FP32_Vector3 v1, v2;
|
||||||
|
|
||||||
my_vector1.x = -2.0f;
|
v1.x = -2.0f;
|
||||||
my_vector1.y = 7.4f;
|
v1.y = 7.4f;
|
||||||
my_vector1.z = 1.8f;
|
v1.z = 1.8f;
|
||||||
|
|
||||||
bgc_fp32_vector3_copy(&my_vector2, &my_vector1);
|
bgc_fp32_vector3_copy(&v2, &v1);
|
||||||
|
|
||||||
printf("x = %f, y = %f, z = %f\n", my_vector2.x, my_vector2.y, my_vector2.z);
|
printf("x = %f, y = %f, z = %f\n", v2.x, v2.y, v2.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,11 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector3 my_vector;
|
BGC_FP32_Vector3 v;
|
||||||
|
|
||||||
bgc_fp32_vector3_reset(&my_vector);
|
bgc_fp32_vector3_reset(&v);
|
||||||
|
|
||||||
printf("x = %f, y = %f, z = %f\n", my_vector.x, my_vector.y, my_vector.z);
|
printf("x = %f, y = %f, z = %f\n", v.x, v.y, v.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,11 @@ vector->z = 0;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector3 my_vector;
|
BGC_FP32_Vector3 v;
|
||||||
|
|
||||||
bgc_fp32_vector3_reset(&my_vector);
|
bgc_fp32_vector3_reset(&v);
|
||||||
|
|
||||||
printf("x = %f, y = %f, z = %f\n", my_vector.x, my_vector.y, my_vector.z);
|
printf("x = %f, y = %f, z = %f\n", v.x, v.y, v.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector3 my_vector;
|
BGC_FP32_Vector3 v;
|
||||||
|
|
||||||
bgc_fp32_vector3_set_values(&my_vector, -2.2f, 7.1f, 10.01f);
|
bgc_fp32_vector3_set_values(&v, -2.2f, 7.1f, 10.01f);
|
||||||
|
|
||||||
printf("x = %f, y = %f, z = %f\n", my_vector.x, my_vector.y, my_vector.z);
|
printf("x = %f, y = %f, z = %f\n", v.x, v.y, v.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@ destination->z = z;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector3 my_vector;
|
BGC_FP32_Vector3 v;
|
||||||
|
|
||||||
bgc_fp32_vector3_set_values(&my_vector, -2.2f, 7.1f, 10.01f);
|
bgc_fp32_vector3_set_values(&v, -2.2f, 7.1f, 10.01f);
|
||||||
|
|
||||||
printf("x = %f, y = %f, z = %f\n", my_vector.x, my_vector.y, my_vector.z);
|
printf("x = %f, y = %f, z = %f\n", v.x, v.y, v.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,15 @@ Example of use:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector3 my_vector1, my_vector2;
|
BGC_FP32_Vector3 v1, v2;
|
||||||
|
|
||||||
bgc_fp32_vector3_set_values(&my_vector1, -2, 7, 5);
|
bgc_fp32_vector3_set_values(&v1, -2, 7, 5);
|
||||||
bgc_fp32_vector3_set_values(&my_vector2, 10, -1, -3);
|
bgc_fp32_vector3_set_values(&v2, 10, -1, -3);
|
||||||
|
|
||||||
bgc_fp32_vector3_swap(&my_vector1, &my_vector2);
|
bgc_fp32_vector3_swap(&v1, &v2);
|
||||||
|
|
||||||
printf("Vector #1: x = %f, y = %f, z = %f\n", my_vector1.x, my_vector1.y, my_vector1.z);
|
printf("Vector #1: x = %f, y = %f, z = %f\n", v1.x, v1.y, v1.z);
|
||||||
printf("Vector #2: x = %f, y = %f, z = %f\n", my_vector2.x, my_vector2.y, my_vector2.z);
|
printf("Vector #2: x = %f, y = %f, z = %f\n", v2.x, v2.y, v2.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,15 @@ inline void bgc_fp64_vector3_swap(BGC_FP64_Vector3* const vector1, BGC_FP64_Vect
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BGC_FP32_Vector3 my_vector1, my_vector2;
|
BGC_FP32_Vector3 v1, v2;
|
||||||
|
|
||||||
bgc_fp32_vector3_set_values(&my_vector1, -2, 7, 5);
|
bgc_fp32_vector3_set_values(&v1, -2, 7, 5);
|
||||||
bgc_fp32_vector3_set_values(&my_vector2, 10, -1, -3);
|
bgc_fp32_vector3_set_values(&v2, 10, -1, -3);
|
||||||
|
|
||||||
bgc_fp32_vector3_swap(&my_vector1, &my_vector2);
|
bgc_fp32_vector3_swap(&v1, &v2);
|
||||||
|
|
||||||
printf("Vector #1: x = %f, y = %f, z = %f\n", my_vector1.x, my_vector1.y, my_vector1.z);
|
printf("Vector #1: x = %f, y = %f, z = %f\n", v1.x, v1.y, v1.z);
|
||||||
printf("Vector #2: x = %f, y = %f, z = %f\n", my_vector2.x, my_vector2.y, my_vector2.z);
|
printf("Vector #2: x = %f, y = %f, z = %f\n", v2.x, v2.y, v2.z);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue