Исправление структуры документации

This commit is contained in:
Andrey Pokidov 2025-02-08 01:22:19 +07:00
parent f8f6b07c81
commit e15070ce45
20 changed files with 316 additions and 135 deletions

50
docs/vector2/copy-eng.md Normal file
View file

@ -0,0 +1,50 @@
# Copying
The copy functions allow you to copy the coordinate values of one vector to another vector.
Function for **BgcVector2FP32**:
```c
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);
```
Each of these functions is equivalent to the following lines of code:
```c
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** 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.
The **to** parameter must be a pointer to a two-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.
Example of use:
```c
#include <stdio.h>
#include <basic-geometry.h>
int main()
{
BgcVector2FP32 my_vector1, my_vector2;
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
bgc_vector2_copy_fp32(&my_vector1, &my_vector2);
printf("x1 = %f, x2 = %f\n", my_vector2.x1, my_vector2.x2);
return 0;
}
```
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)

50
docs/vector2/copy-rus.md Normal file
View file

@ -0,0 +1,50 @@
# Копирование
Функции копирования позволяют скопировать значения координат одного вектора в другой вектор.
Функция для **BgcVector2FP32**:
```c
inline void bgc_vector2_copy_fp32(const BgcVector2FP32* from, BgcVector2FP32* to);
```
Функция для **BgcVector2FP64**:
```c
inline void bgc_vector2_copy_fp64(const BgcVector2FP64* from, BgcVector2FP64* to);
```
Каждая из данных функции эквивалентна следующим строкам кода:
```c
to->x1 = from->x1;
to->x2 = from->x2;
```
В данные функции не следует передавать некорректные указатели. Значение NULL (0) также считается некорректным.
Параметр **from** должен быть указателем на двумерный вектор, координаты которого должны быть скопированы. Координаты вектора **from** не изменятся после вызова функции.
Параметр **to** должен быть указателем на двумерный вектор, координаты которого должны быть изменены. Координаты вектора **to** после вызова функции станут такими же, как и у вектора **from**.
Пример применения:
```c
#include <stdio.h>
#include <basic-geometry.h>
int main()
{
BgcVector2FP32 my_vector1, my_vector2;
bgc_vector2_set_values_fp32(-2, 7, &my_vector1);
bgc_vector2_copy_fp32(&my_vector1, &my_vector2);
printf("x1 = %f, x2 = %f\n", my_vector2.x1, my_vector2.x2);
return 0;
}
```
[Документация](../intro-rus.md) / [2D векторы](../vector2-rus.md)

View file

@ -41,4 +41,4 @@ Example of use:
}
```
[Back](../vector2-eng.md)
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)

View file

@ -41,4 +41,4 @@
}
```
[Íàçàä](../vector2-rus.md)
[Äîêóìåíòàöèÿ](../intro-rus.md) / [2D âåêòîðû](../vector2-rus.md)

View file

@ -0,0 +1,44 @@
# Setting the coordinates of a two-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.
Function for **BgcVector2FP32**:
```c
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);
```
Each of these functions is equivalent to the following lines of code:
```c
vector->x1 = x1;
vector->x2 = x2;
```
You should not pass invalid pointers to these functions. The value NULL (0) is also considered invalid.
Example of use:
```c
#include <stdio.h>
#include <basic-geometry.h>
int main()
{
BgcVector2FP32 my_vector;
bgc_vector2_set_values_fp32(-2, 7, &my_vector);
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
return 0;
}
```
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)

View file

@ -0,0 +1,44 @@
# Задание координат двумерного вектора
Задавать координаты векторов можно как напрямую, так и спомощью функций. Функции задания значений координат позволяют сделать это одной строкой.
Функция для **BgcVector2FP32**:
```c
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);
```
Каждая из данных функции эквивалентна следующим строкам кода:
```c
vector->x1 = x1;
vector->x2 = x2;
```
В данные функции не следует передавать некорректные указатели. Значение NULL (0) также считается некорректным.
Пример применения:
```c
#include <stdio.h>
#include <basic-geometry.h>
int main()
{
BgcVector2FP32 my_vector;
bgc_vector2_set_values_fp32(-2, 7, &my_vector);
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
return 0;
}
```
[Документация](../intro-rus.md) / [2D векторы](../vector2-rus.md)

44
docs/vector2/swap-eng.md Normal file
View file

@ -0,0 +1,44 @@
# Swapping
The exchange functions allow two vectors of the same type to exchange coordinate values.
Function for **BgcVector2FP32**:
```c
inline void bgc_vector2_swap_fp32(BgcVector2FP32* vector1, BgcVector2FP32* vector2);
```
Function for **BgcVector2FP32**:
```c
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.
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>
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_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);
return 0;
}
```
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)

44
docs/vector2/swap-rus.md Normal file
View file

@ -0,0 +1,44 @@
# Îáìåí
Ôóíêöèè îáìåíà ïîçâîëÿþò äâóì âåêòîðàì îäíîãî òèïà îáìåíÿòüñÿ çíà÷åíèÿìè êîîðäèíàò.
Ôóíêöèÿ äëÿ **BgcVector2FP32**:
```c
inline void bgc_vector2_swap_fp32(BgcVector2FP32* vector1, BgcVector2FP32* vector2);
```
Ôóíêöèÿ äëÿ **BgcVector2FP32**:
```c
inline void bgc_vector2_swap_fp64(BgcVector2FP64* vector1, BgcVector2FP64* vector2);
```
 äàííûå ôóíêöèè íå ñëåäóåò ïåðåäàâàòü íåêîððåêòíûå óêàçàòåëè. Çíà÷åíèå NULL (0) òàêæå ñ÷èòàåòñÿ íåêîððåêòíûì.
Âåêòîð **vector1** ïîñëå âûçîâà äàííîé ôóíêöèè áóäåò èìåòü çíà÷åíèÿ êîîðäèíàò, êàêèå èìåë âåêòîð **vector2** äî âûçîâà ôóíêöèè.
À âåêòîð **vector2** ïîñëå âûçîâà äàííîé ôóíêöèè áóäåò èìåòü òàêèå æå çíà÷åíèÿ êîîðäèíàò, êàêèå èìåë âåêòîð **vector1** äî âûçîâà ôóíêöèè.
Ïðèìåð ïðèìåíåíèÿ:
```c
#include <stdio.h>
#include <basic-geometry.h>
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_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);
return 0;
}
```
[Äîêóìåíòàöèÿ](../intro-rus.md) / [2D âåêòîðû](../vector2-rus.md)