Добавление документации по трёхмерным векторам и исправления
This commit is contained in:
parent
e15070ce45
commit
02bcb1bd33
24 changed files with 593 additions and 132 deletions
|
|
@ -5,23 +5,23 @@ The copy functions allow you to copy the coordinate values of one vector to anot
|
|||
Function for **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_copy_fp32(const BgcVector2FP32* from, BgcVector2FP32* to);
|
||||
inline void bgc_vector2_copy_fp32(const BgcVector2FP32* from, BgcVector2FP32* to);
|
||||
```
|
||||
|
||||
Function for **BgcVector2FP64**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_copy_fp64(const BgcVector2FP64* from, BgcVector2FP64* to);
|
||||
inline void bgc_vector2_copy_fp64(const BgcVector2FP64* from, BgcVector2FP64* to);
|
||||
```
|
||||
|
||||
Each of these functions is equivalent to the following lines of code:
|
||||
|
||||
```c
|
||||
to->x1 = from->x1;
|
||||
to->x2 = from->x2;
|
||||
to->x1 = from->x1;
|
||||
to->x2 = from->x2;
|
||||
```
|
||||
|
||||
You should not pass invalid pointers to these functions. The NULL (0) value is also considered invalid.
|
||||
The **from** and **to** parameters must not be invalid pointers. The NULL (0) value is also considered invalid.
|
||||
|
||||
The **from** parameter must be a pointer to a two-dimensional vector whose coordinates are to be copied. The coordinates of the **from** vector will not change after the function call.
|
||||
|
||||
|
|
@ -30,21 +30,21 @@ The **to** parameter must be a pointer to a two-dimensional vector whose coordin
|
|||
Example of use:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
|
||||
|
||||
bgc_vector2_copy_fp32(&my_vector1, &my_vector2);
|
||||
bgc_vector2_copy_fp32(&my_vector1, &my_vector2);
|
||||
|
||||
printf("x1 = %f, x2 = %f\n", my_vector2.x1, my_vector2.x2);
|
||||
printf("x1 = %f, x2 = %f\n", my_vector2.x1, my_vector2.x2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)
|
||||
|
|
|
|||
|
|
@ -5,23 +5,23 @@
|
|||
Функция для **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_copy_fp32(const BgcVector2FP32* from, BgcVector2FP32* to);
|
||||
inline void bgc_vector2_copy_fp32(const BgcVector2FP32* from, BgcVector2FP32* to);
|
||||
```
|
||||
|
||||
Функция для **BgcVector2FP64**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_copy_fp64(const BgcVector2FP64* from, BgcVector2FP64* to);
|
||||
inline void bgc_vector2_copy_fp64(const BgcVector2FP64* from, BgcVector2FP64* to);
|
||||
```
|
||||
|
||||
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||
|
||||
```c
|
||||
to->x1 = from->x1;
|
||||
to->x2 = from->x2;
|
||||
to->x1 = from->x1;
|
||||
to->x2 = from->x2;
|
||||
```
|
||||
|
||||
 äàííûå ôóíêöèè íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
Ïàðàìåòðû **from** è **to** íå äîëæíû áûòü íåêîððåêòíûìè óêàçàòåëÿìè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
|
||||
Параметр **from** должен быть указателем на двумерный вектор, координаты которого должны быть скопированы. Координаты вектора **from** не изменятся после вызова функции.
|
||||
|
||||
|
|
@ -30,21 +30,21 @@
|
|||
Пример применения:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
|
||||
|
||||
bgc_vector2_copy_fp32(&my_vector1, &my_vector2);
|
||||
bgc_vector2_copy_fp32(&my_vector1, &my_vector2);
|
||||
|
||||
printf("x1 = %f, x2 = %f\n", my_vector2.x1, my_vector2.x2);
|
||||
printf("x1 = %f, x2 = %f\n", my_vector2.x1, my_vector2.x2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Документация](../intro-rus.md) / [2D векторы](../vector2-rus.md)
|
||||
|
|
|
|||
|
|
@ -5,20 +5,20 @@ These functions set all coordinates of 2D vectors to 0.
|
|||
Function for **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_reset_fp32(BgcVector2FP32* vector);
|
||||
inline void bgc_vector2_reset_fp32(BgcVector2FP32* vector);
|
||||
```
|
||||
|
||||
Function for **BgcVector2FP64**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_reset_fp64(BgcVector2FP64* vector);
|
||||
inline void bgc_vector2_reset_fp64(BgcVector2FP64* vector);
|
||||
```
|
||||
|
||||
Each of these functions is equivalent to the following lines of code:
|
||||
|
||||
```c
|
||||
vector->x1 = 0;
|
||||
vector->x2 = 0;
|
||||
vector->x1 = 0;
|
||||
vector->x2 = 0;
|
||||
```
|
||||
|
||||
You should not pass invalid pointers to these functions. The NULL (0) value is also considered invalid.
|
||||
|
|
@ -26,19 +26,19 @@ You should not pass invalid pointers to these functions. The NULL (0) value is a
|
|||
Example of use:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
|
||||
bgc_vector2_reset_fp32(&my_vector);
|
||||
bgc_vector2_reset_fp32(&my_vector);
|
||||
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)
|
||||
|
|
|
|||
|
|
@ -5,40 +5,40 @@
|
|||
Функция для **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_reset_fp32(BgcVector2FP32* vector);
|
||||
inline void bgc_vector2_reset_fp32(BgcVector2FP32* vector);
|
||||
```
|
||||
|
||||
Функция для **BgcVector2FP64**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_reset_fp64(BgcVector2FP64* vector);
|
||||
inline void bgc_vector2_reset_fp64(BgcVector2FP64* vector);
|
||||
```
|
||||
|
||||
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||
|
||||
```c
|
||||
vector->x1 = 0;
|
||||
vector->x2 = 0;
|
||||
vector->x1 = 0;
|
||||
vector->x2 = 0;
|
||||
```
|
||||
|
||||
 äàííûå ôóíêöèè íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
 ïàðàìåòðå **vector** íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
|
||||
Пример применения:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
|
||||
bgc_vector2_reset_fp32(&my_vector);
|
||||
bgc_vector2_reset_fp32(&my_vector);
|
||||
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Документация](../intro-rus.md) / [2D векторы](../vector2-rus.md)
|
||||
|
|
|
|||
|
|
@ -5,40 +5,40 @@ You can set the coordinates of vectors either directly or using functions. The f
|
|||
Function for **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_set_values_fp32(const float x1, const float x2, BgcVector2FP32* to);
|
||||
inline void bgc_vector2_set_values_fp32(const float x1, const float x2, BgcVector2FP32* to);
|
||||
```
|
||||
|
||||
Function for **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_set_values_fp64(const double x1, const double x2, BgcVector2FP64* to);
|
||||
inline void bgc_vector2_set_values_fp64(const double x1, const double x2, BgcVector2FP64* to);
|
||||
```
|
||||
|
||||
Each of these functions is equivalent to the following lines of code:
|
||||
|
||||
```c
|
||||
vector->x1 = x1;
|
||||
vector->x2 = x2;
|
||||
to->x1 = x1;
|
||||
to->x2 = x2;
|
||||
```
|
||||
|
||||
You should not pass invalid pointers to these functions. The value NULL (0) is also considered invalid.
|
||||
Invalid pointers should not be passed in the **to** parameter. The NULL (0) value is also considered invalid.
|
||||
|
||||
Example of use:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector);
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector);
|
||||
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)
|
||||
|
|
|
|||
|
|
@ -5,40 +5,40 @@
|
|||
Функция для **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_set_values_fp32(const float x1, const float x2, BgcVector2FP32* to);
|
||||
inline void bgc_vector2_set_values_fp32(const float x1, const float x2, BgcVector2FP32* to);
|
||||
```
|
||||
|
||||
Функция для **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_set_values_fp64(const double x1, const double x2, BgcVector2FP64* to);
|
||||
inline void bgc_vector2_set_values_fp64(const double x1, const double x2, BgcVector2FP64* to);
|
||||
```
|
||||
|
||||
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||
|
||||
```c
|
||||
vector->x1 = x1;
|
||||
vector->x2 = x2;
|
||||
to->x1 = x1;
|
||||
to->x2 = x2;
|
||||
```
|
||||
|
||||
 äàííûå ôóíêöèè íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
 ïàðàìåòðå **to** íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
|
||||
Пример применения:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector);
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector);
|
||||
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Документация](../intro-rus.md) / [2D векторы](../vector2-rus.md)
|
||||
|
|
|
|||
|
|
@ -5,40 +5,41 @@ The exchange functions allow two vectors of the same type to exchange coordinate
|
|||
Function for **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_swap_fp32(BgcVector2FP32* vector1, BgcVector2FP32* vector2);
|
||||
inline void bgc_vector2_swap_fp32(BgcVector2FP32* vector1, BgcVector2FP32* vector2);
|
||||
```
|
||||
|
||||
Function for **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_swap_fp64(BgcVector2FP64* vector1, BgcVector2FP64* vector2);
|
||||
inline void bgc_vector2_swap_fp64(BgcVector2FP64* vector1, BgcVector2FP64* vector2);
|
||||
```
|
||||
|
||||
You should not pass invalid pointers to these functions. The value NULL (0) is also considered invalid.
|
||||
The **vector1** and **vector2** parameters must not be invalid pointers. The NULL (0) value is also considered invalid.
|
||||
|
||||
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.
|
||||
|
||||
Example of use:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
|
||||
bgc_vector2_set_values_fp32(10, -1, &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_vector2_swap_fp32(&my_vector1, &my_vector2);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)
|
||||
|
|
|
|||
|
|
@ -1,44 +1,45 @@
|
|||
# Îáìåí
|
||||
# Обмен
|
||||
|
||||
Ôóíêöèè îáìåíà ïîçâîëÿþò äâóì âåêòîðàì îäíîãî òèïà îáìåíÿòüñÿ çíà÷åíèÿìè êîîðäèíàò.
|
||||
Функции обмена позволяют двум векторам одного типа обменяться значениями координат.
|
||||
|
||||
Ôóíêöèÿ äëÿ **BgcVector2FP32**:
|
||||
Функция для **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_swap_fp32(BgcVector2FP32* vector1, BgcVector2FP32* vector2);
|
||||
inline void bgc_vector2_swap_fp32(BgcVector2FP32* vector1, BgcVector2FP32* vector2);
|
||||
```
|
||||
|
||||
Ôóíêöèÿ äëÿ **BgcVector2FP32**:
|
||||
Функция для **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_swap_fp64(BgcVector2FP64* vector1, BgcVector2FP64* vector2);
|
||||
inline void bgc_vector2_swap_fp64(BgcVector2FP64* vector1, BgcVector2FP64* vector2);
|
||||
```
|
||||
|
||||
 äàííûå ôóíêöèè íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
|
||||
Параметры **vector1** и **vector2** не должны быть некорректными указателями. Значение NULL (0) также считается некорректным.
|
||||
|
||||
Âåêòîð **vector1** ïîñëå âûçîâà äàííîé ôóíêöèè áóäåò èìåòü çíà÷åíèÿ êîîðäèíàò, êàêèå èìåë âåêòîð **vector2** äî âûçîâà ôóíêöèè.
|
||||
À âåêòîð **vector2** ïîñëå âûçîâà äàííîé ôóíêöèè áóäåò èìåòü òàêèå æå çíà÷åíèÿ êîîðäèíàò, êàêèå èìåë âåêòîð **vector1** äî âûçîâà ôóíêöèè.
|
||||
Вектор **vector1** после вызова данной функции будет иметь значения координат, какие имел вектор **vector2** до вызова функции.
|
||||
|
||||
Ïðèìåð ïðèìåíåíèÿ:
|
||||
А вектор **vector2** после вызова данной функции будет иметь такие же значения координат, какие имел вектор **vector1** до вызова функции.
|
||||
|
||||
Пример применения:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector1, my_vector2;
|
||||
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
|
||||
bgc_vector2_set_values_fp32(10, -1, &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_vector2_swap_fp32(&my_vector1, &my_vector2);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Äîêóìåíòàöèÿ](../intro-rus.md) / [2D âåêòîðû](../vector2-rus.md)
|
||||
[Документация](../intro-rus.md) / [2D векторы](../vector2-rus.md)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue