diff --git a/docs/intro-deu.md b/docs/intro-deu.md new file mode 100644 index 0000000..b2604be --- /dev/null +++ b/docs/intro-deu.md @@ -0,0 +1,76 @@ +# Bibliothek für grundlegende geometrische Berechnungen + +[Русский (Russisch)](intro-rus.md) +[English (Englisch)](intro-eng.md) +[简体中文 (Chinesisch)](intro-zho.md) + +**Hinweis**: Dieser Text wurde mithilfe der maschinellen Übersetzung von Google aus der russischen Version erstellt. + +## Namenskonventionen + +Die Programmiersprache C kennt keine Namensräume. Daher dienen Präfixe in Namen als deren Funktion. + +Die Bibliothek verwendet Präfixe in den Namen von Typen, Konstanten und Funktionen, um Namenskonflikte mit anderen Bibliotheken zu vermeiden. + +### Bibliothekspräfix (Primäres Präfix) + +Das primäre Präfix ist **BGC** (Abkürzung für **B**asic **G**eometric **C**computations, was übersetzt „Grundlegende geometrische Berechnungen“ bedeutet). + +Für Konstanten und Datenstrukturen lautet das Präfix **BGC_**. + +Beispiele für Strukturen: +- BGC_FP64_Vector3 +- BGC_FP32_Quaternion +- BGC_FP32_Matrix2x2 + +Konstanten: +- BGC_FP32_EPSILON +- BGC_FP64_TWO_PI + +Funktionen haben das Präfix **bgc_**, zum Beispiel: +- bgc_fp32_turn3_combine +- bgc_fp64_matrix3x3_subtract + +### Basistyppräfix (Sekundärpräfix) + +Nach dem Bibliothekspräfix folgt das Basistyppräfix. + +Die Bibliothek verwendet zwei Gleitkommazahlentypen: **float** und **double** (die Typen **binary32** und **binary64** des **IEEE 754**-Standards). + +Die Bibliothek verwendet daher zwei Typpräfixe: +- **FP32** bedeutet "Floating Point 32-bit", also eine 32-Bit-Gleitkommazahl, die dem Datentyp **float** in der Programmiersprache C entspricht. +- **FP64** bedeutet "Floating Point 64-bit", also eine 64-Bit-Gleitkommazahl, die dem Datentyp **double** in der Programmiersprache C entspricht. + +Strukturtypen und Konstanten, die auf dem Typ **float** basieren, haben das Präfix **FP32_**: +- BGC_FP32_Vector3 +- BGC_FP32_Matrix3x2 +- BGC_FP32_Quaternion +- BGC_FP32_PI +- BGC_FP32_EPSILON + +Strukturtypen und Konstanten, die auf dem Typ **double** basieren, haben das Präfix **FP64_**: +- BGC_FP64_Vector2 +- BGC_FP64_Matrix2x3 +- BGC_FP64_Turn3 +- BGC_FP64_HALF_PI +- BGC_FP64_ONE_THIRD + +Funktionen, die mit **float**-Daten arbeiten, haben das Präfix **fp32_**: +- bgc_fp32_vector2_get_length +- bgc_fp32_radians_to_degrees + +Funktionen, die mit **double**-Datentypen arbeiten, haben das Präfix **fp32_**: +- bgc_fp32_vector2_get_length +- bgc_fp32_radians_to_degrees + +Funktionen, die mit **double**-Datentypen arbeiten, haben das Präfix **fp64_**: +- bgc_fp64_vector3_reset +- bgc_fp64_normalize_radians + +Durch die Verwendung solcher Präfixe kann die Bibliothek zukünftig um neue Basistypen erweitert werden. + +### Datentypen + +- [Zweidimensionale Vektoren](vector2-rus.md) +- [Dreidimensionale Vektoren](vector3-rus.md) +- [Quaternionen](quaternion-rus.md) diff --git a/docs/intro-eng.md b/docs/intro-eng.md index 988a13f..d0f6561 100644 --- a/docs/intro-eng.md +++ b/docs/intro-eng.md @@ -1,8 +1,10 @@ # Basic Geomtric Computations -[Русская версия / Russian version](intro-rus.md) +[Русский (Russian)](intro-rus.md) +[Deutsch (German)](intro-deu.md) +[简体中文 (Chinese)](intro-zho.md) -## Naming +## Naming C programming language does not have namespaces, thus prefixes often play role of namespaces in C code. @@ -34,8 +36,8 @@ Prefixs of type ends the names of constats, types and functions of the library. The library uses two types of floating point numbers: **float** and **double** (**binary32** and **binary64** types of the **IEEE 754** standard). Thus there are two prefixes of types: -- **FP32** - means **F**loating **P**oint, **32** bit, which corresponds to the **float** type of the C programming language. -- **FP64** - means **F**loating **P**oint, **64** bit, which corresponds to the **double** type of the C programming language. +- **FP32** - means Floating Point, 32-bit, which corresponds to the **float** type of the C programming language. +- **FP64** - means Floating Point, 64-bit, which corresponds to the **double** type of the C programming language. The constants and the types of structures which are based in the **float** type have **FP32_** as the type prefix: - BGC_FP32_Vector3 @@ -66,4 +68,3 @@ Using of such prefixes of a basic type allows to enhance the library with new ba - [2D-vectors](vector2-eng.md) - [3D-vectors](vector3-eng.md) - [Quaternions](quaternion-rus.md) - diff --git a/docs/intro-rus.md b/docs/intro-rus.md index 454e735..db34d20 100644 --- a/docs/intro-rus.md +++ b/docs/intro-rus.md @@ -1,6 +1,8 @@ # Библиотека базовых геометрических вычислений -[English version / Английская версия](intro-eng.md) +[English (Английский)](intro-eng.md) +[Deutsch (Немецкий)](intro-deu.md) +[简体中文 (Китайский)](intro-zho.md) ## Особенности наименования @@ -34,8 +36,8 @@ Библиотека использует два типа чисел с плавающей запятой: **float** и **double** (типы **binary32** и **binary64** стандарта **IEEE 754**). Поэтому в библиотеке есть два префикса типа: -- **FP32** - означает **F**loating **P**oint **32** bit, то есть, число с плавающей запятой, 32 бита, что соответствует типу **float** языка программирования Си. -- **FP64** - означает **F**loating **P**oint **64** bit, то есть, число с плавающей запятой, 64 бита, что соответствует типу **double** языка программирования Си. +- **FP32** - означает Floating Point 32-bit, то есть, число с плавающей запятой, 32 бита, что соответствует типу **float** языка программирования Си. +- **FP64** - означает Floating Point 64-bit, то есть, число с плавающей запятой, 64 бита, что соответствует типу **double** языка программирования Си. Типы структур и константы, основанные на типе **float** имеют префикс **FP32_**: - BGC_FP32_Vector3 @@ -66,4 +68,3 @@ - [Двумерные векторы](vector2-rus.md) - [Трёхмерные векторы](vector3-rus.md) - [Кватернионы](quaternion-rus.md) - diff --git a/docs/intro-zho.md b/docs/intro-zho.md new file mode 100644 index 0000000..76e4c61 --- /dev/null +++ b/docs/intro-zho.md @@ -0,0 +1,72 @@ +# 基础几何计算库 + +[Русский (俄语)](intro-rus.md) +[English (英语)](intro-eng.md) +[Deutsch (德语)](intro-deu.md) + +**注**:此文本由俄语版本经谷歌机器翻译获得。 + +## 命名注意事项 + +C 语言没有命名空间,因此名称中的前缀起到了命名空间的作用。 + +该库在类型、常量和函数的名称中使用前缀,以避免与其他库发生命名冲突。 + +### 库前缀(主前缀) + +主前缀为 **BGC**(**B**asic **G**eometric **C**computations 的缩写,可译为“基础几何计算”)。 + +对于常量和数据结构,前缀为 **BGC_** + +例如,结构体: +- BGC_FP64_Vector3 +- BGC_FP32_Quaternion +- BGC_FP32_Matrix2x2 + +常量: +- BGC_FP32_EPSILON +- BGC_FP64_TWO_PI + +函数的前缀为 **bgc_**,例如: +- bgc_fp32_turn3_combine +- bgc_fp64_matrix3x3_subtract + +### 基本类型前缀(辅助前缀) + +库前缀之后是基本类型前缀。 + +该库使用两种浮点数类型:**float** 和 **double**(**IEEE 754** 标准的 **binary32** 和 **binary64** 类型)。 + +因此,该库有两个类型前缀: +- **FP32** - 表示 Floating Point 32-bit, 即 32 位浮点数,对应于 C 语言中的 **float** 类型。 +- **FP64** - 表示 Floating Point 64-bit,即 64 位浮点数,对应于 C 语言中的 **double** 类型。 + +基于浮点数类型的结构体和常量以 FP32_** 为前缀: +- BGC_FP32_Vector3 +- BGC_FP32_Matrix3x2 +- BGC_FP32_Quaternion +- BGC_FP32_PI +- BGC_FP32_EPSILON + +基于双精度浮点数类型的结构体和常量以 FP64_** 为前缀: +- BGC_FP64_Vector2 +- BGC_FP64_Matrix2x3 +- BGC_FP64_Turn3 +- BGC_FP64_HALF_PI +- BGC_FP64_ONE_THIRD + +处理浮点数数据的函数以 **fp32_** 为前缀: +- bgc_fp32_vector2_get_length +- bgc_fp32_radians_to_degrees + +处理双精度浮点数数据类型的函数以 **fp64_** 前缀: +- bgc_fp64_vector3_reset +- bgc_fp64_normalize_radians + +使用此类前缀可使库在未来扩展以支持新的基本类型。 + +### 数据类型 + +- [二维向量](vector2-zho.md) +- [三维向量](vector3-zho.md) +- [四元数](quaternion-zho.md) diff --git a/docs/quaternion-eng.md b/docs/quaternion-eng.md index 4bbe6bf..4a658a9 100644 --- a/docs/quaternion-eng.md +++ b/docs/quaternion-eng.md @@ -5,13 +5,13 @@ Quaternions are hypercomplex numbers that extend the concept of complex numbers. They consist of one real component and three imaginary components: -q = s + ix + jy + kz +q = s + i⋅x + j⋅y + k⋅z where: - s, x, y, z ∈ R are real numbers - i, j, k are imaginary units that satisfy the following conditions: - - i2 = j2 = k2 = ijk = -1 + - i2 = j2 = k2 = i⋅j⋅k = -1 Quaternions were discovered by mathematician William Hamilton and introduced to the public in 1843. They have found wide application in computer graphics, @@ -38,11 +38,15 @@ Structure definitions: ``` Fields: -- **s** is the real part of the quaternion. It is named after the word "scalar". -- **x**, **y**, **z** - Imaginary components of the quaternion. +- *s* is the real part of the quaternion. It is named after the word "scalar". +- *x*, *y*, *z* - Imaginary components of the quaternion. ## Functions +- [Reset](quaternion/reset-eng.md) + - bgc_fp32_quaternion_reset + - bgc_fp64_quaternion_reset + - [Reset](quaternion/reset-eng.md) - bgc_fp32_quaternion_reset - bgc_fp64_quaternion_reset diff --git a/docs/quaternion-rus.md b/docs/quaternion-rus.md index c71ff06..fdffd32 100644 --- a/docs/quaternion-rus.md +++ b/docs/quaternion-rus.md @@ -5,13 +5,13 @@ Кватернионы — это гиперкомплексные числа, которые расширяют понятие комплексных чисел. Они состоят из одной действительной компоненты и трёх мнимых компонент: -q = s + ix + jy + kz +q = s + i⋅x + j⋅y + k⋅z где: - s, x, y, z ∈ R - действительные числа - i, j, k - мнимые единицы, удовлетворяющие следующим условиям: - - i2 = j2 = k2 = ijk = -1 + - i2 = j2 = k2 = i⋅j⋅k = -1 Кватернионы были открыты математиком Уильямом Гамильтоном и представлены публике в 1843 году. Они нашли широкое применение в компьютерной графике, робототехнике @@ -42,7 +42,9 @@ q = s + ix + jy + kz "scalar" - скалярная величина. - **x**, **y**, **z** - мнимые компоненты кватерниона. -- [Сброс](quaternion/reset-rus.md) +### Функции + +- [Сброс значений компонент](quaternion/reset-rus.md) - bgc_fp32_quaternion_reset - bgc_fp64_quaternion_reset diff --git a/docs/quaternion/copy-eng.md b/docs/quaternion/copy-eng.md index c2ea491..5a373a2 100644 --- a/docs/quaternion/copy-eng.md +++ b/docs/quaternion/copy-eng.md @@ -1,10 +1,7 @@ -# Copying +# Copying of component values [Русская версия / 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 @@ -17,6 +14,8 @@ Function for **BGC_FP64_Quaternion**: inline void bgc_fp64_quaternion_copy(BGC_FP64_Quaternion* const destination, const BGC_FP64_Quaternion* const source); ``` +These functions allow to copy the component values of one quaternion to another quaternion. + Each of these functions is equivalent to the following lines of code: ```c @@ -26,18 +25,16 @@ 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. +### Parameters -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. +| Parameter | Direction | Description | +| ----------- | ---------- | -------------------------------------------------------------------------------- | +| destination | out | A pointer to a quaternion to set component values from *source* | +| source | in | A pointer to a quaternion which component values will be copied to *destination* | -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. +The *source* and *destination* parameters must be valid pointers. The NULL (0) value is also considered invalid. -Example of use: +### Example ```c #include @@ -61,3 +58,4 @@ int main() ``` [Documentation](../intro-eng.md) / [Quaternions](../quaternion-eng.md) + diff --git a/docs/quaternion/copy-rus.md b/docs/quaternion/copy-rus.md index c0a98eb..b1348bd 100644 --- a/docs/quaternion/copy-rus.md +++ b/docs/quaternion/copy-rus.md @@ -1,10 +1,7 @@ -# Копирование +# Копирование значений компотент [English version / Английская версия](copy-eng.md) -Функции копирования позволяют скопировать значения компонент одного кватерниона -в другой кватернион. - Функция для **BGC_FP32_Quaternion**: ```c @@ -17,6 +14,9 @@ inline void bgc_fp32_quaternion_copy(BGC_FP32_Quaternion* const destination, con inline void bgc_fp64_quaternion_copy(BGC_FP64_Quaternion* const destination, const BGC_FP64_Quaternion* const source); ``` +Данные функции позволяют скопировать значения компонентов одного кватерниона в другой кватернион. + + Каждая из данных функции эквивалентна следующим строкам кода: ```c @@ -26,18 +26,16 @@ destination->y = source->y; destination->z = source->z; ``` -Параметры **source** и **destination** должны быть корректными указателями. -Значение NULL (0) также считается некорректным. +### Parameters -Параметр **source** должен быть указателем на кватернион, компоненты которого -должны быть скопированы. Компоненты кватерниона **source** не изменятся после -вызова функции. - -Параметр **destination** должен быть указателем на кватернионы, компоненты -которого должны быть изменены. Координаты кватерниона **destination** после -вызова функции станут такими же, как и у кватерниона **source**. +| Параметр | Направление | Описание | +| ----------- | ----------- | ------------------------------------------------------------------------------------- | +| destination | исходящий | Указатель на кватернион, в который будут скопированы значения компонентов из *source* | +| source | входящий | Указатель на кватернион, компоненты которого должны быть скопированы в *destination* | -Пример применения: +Параметры *source* и *destination* должны быть корректными указателями. Значение NULL (0) также считается некорректным. + +### Пример ```c #include @@ -61,3 +59,4 @@ int main() ``` [Документация](../intro-rus.md) / [Кватернионы](../quaternion-rus.md) + diff --git a/docs/quaternion/reset-eng.md b/docs/quaternion/reset-eng.md index 33b1d9e..7e57b40 100644 --- a/docs/quaternion/reset-eng.md +++ b/docs/quaternion/reset-eng.md @@ -2,8 +2,6 @@ [Русская версия / Russian version](reset-rus.md) -These functions set all parts of a quaternion to 0. - Function for **BGC_FP32_Quaternion**: ```c @@ -16,6 +14,8 @@ Function for **BGC_FP64_Quaternion**: inline void bgc_fp64_quaternion_reset(BGC_FP64_Quaternion* const quaternion); ``` +These functions set all the components of a quaternion to zero. + Each of these functions is equivalent to the following lines of code: ```c @@ -25,12 +25,17 @@ vector->y = 0; vector->z = 0; ``` -You should pass valid pointers to these functions. The NULL (0) value is also -considered invalid. - This function is good for setting up the initial state of a quaternion. -Example of use: +### Parameter + +| Parameter | Direction | Description | +| ---------- | --------- | ------------------------------------------------------------ | +| quaternion | out | A pointer to a quaternions which components must be set to 0 | + +You should pass only valid pointers in the parameter *quaternion*. The NULL (0) value is considered invalid. + +### Example ```c #include @@ -49,3 +54,4 @@ int main() ``` [Documentation](../intro-eng.md) / [Quaternions](../quaternion-eng.md) + diff --git a/docs/quaternion/reset-rus.md b/docs/quaternion/reset-rus.md index 94b0dea..af3becc 100644 --- a/docs/quaternion/reset-rus.md +++ b/docs/quaternion/reset-rus.md @@ -2,8 +2,6 @@ [English version / Английская версия](reset-eng.md) -Функции устанавливают значение 0 всем координатам двумерных векторов. - Функция для **BGC_FP32_Quaternion**: ```c @@ -16,6 +14,8 @@ inline void bgc_fp32_quaternion_reset(BGC_FP32_Quaternion* const quaternion); inline void bgc_fp64_quaternion_reset(BGC_FP64_Quaternion* const quaternion); ``` +Функции устанавливают значение 0 всем компонентам кватерниона. + Каждая из данных функции эквивалентна следующим строкам кода: ```c @@ -25,13 +25,17 @@ vector->y = 0; vector->z = 0; ``` -В параметре **quaternion** следует передавать корректный указатель на -существующую область памяти. Значение NULL (0) считается некорректным. +Данная функция хорошо подходит для инициализации начального состояния кватерниона. -Данная функция хорошо подходит для инициализации начального состояния -кватерниона. +### Параметр -Пример применения: +| Параметр | Направление | Описание | +| ---------- | ----------- | ------------------------------------------------------------------------ | +| quaternion | исходящий | Указатель на кватернион, компоненты которого должны быть установлены в 0 | + +Необходимо передавать только корректные указатели в параметр *quaternion*. Значение NULL (0) также считается некорректным. + +### Пример ```c #include @@ -50,3 +54,4 @@ int main() ``` [Документация](../intro-rus.md) / [Кватернионы](../quaternion-rus.md) + diff --git a/docs/quaternion/swap-eng.md b/docs/quaternion/swap-eng.md index 07dedc2..528c518 100644 --- a/docs/quaternion/swap-eng.md +++ b/docs/quaternion/swap-eng.md @@ -28,7 +28,7 @@ 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: +### Example ```c #include diff --git a/docs/quaternion/swap-rus.md b/docs/quaternion/swap-rus.md index 8617bb0..e3fbce8 100644 --- a/docs/quaternion/swap-rus.md +++ b/docs/quaternion/swap-rus.md @@ -26,7 +26,7 @@ inline void bgc_fp64_quaternion_swap(BGC_FP64_Quaternion* const quarternion1, BG А кватернион **quarternion2** после вызова данной функции будет иметь такие же значения компонет, какие имел кватернион **quarternion1** до вызова функции. -Пример применения: +### Пример ```c #include diff --git a/docs/vector2-eng.md b/docs/vector2-eng.md index 75ef05b..3f865d3 100644 --- a/docs/vector2-eng.md +++ b/docs/vector2-eng.md @@ -1,6 +1,6 @@ # Two-dimensional vectors -[Русская версия / Russian version](vector2-rus.md) +[Русский (Russian)](vector2-rus.md) There are two types of 2D vectors in the library: - **BGC_FP32_Vector2** - vector using single-precision floating-point numbers diff --git a/docs/vector2-rus.md b/docs/vector2-rus.md index f19b1ad..27e7d2a 100644 --- a/docs/vector2-rus.md +++ b/docs/vector2-rus.md @@ -1,6 +1,6 @@ # Двумерные векторы векторы -[English version / Английская версия](vector2-eng.md) +[English (Английский)](vector2-eng.md) В библиотеке есть два типа двумерных векторов: - **BGC_FP32_Vector2** - вектор с использованием чисел с плавающей запятой одинарной точности diff --git a/docs/vector3/copy-eng.md b/docs/vector3/copy-eng.md index bae43d4..7517d4b 100644 --- a/docs/vector3/copy-eng.md +++ b/docs/vector3/copy-eng.md @@ -31,7 +31,7 @@ destination->z = source->z; | destination | out | A pointer to a vector to set coordinate values from *source* | | source | in | A pointer to a vector which coordinates will be copied to *destination* | -The **source** and **destination** parameters must be valid pointers. The NULL (0) value is also considered invalid. +The *source* and *destination* parameters must be valid pointers. The NULL (0) value is also considered invalid. ### Example diff --git a/docs/vector3/reset-eng.md b/docs/vector3/reset-eng.md index 72b6262..b39fea8 100644 --- a/docs/vector3/reset-eng.md +++ b/docs/vector3/reset-eng.md @@ -28,9 +28,9 @@ This function is good for setting up the initial state of a 3D vector. ### Parameters -| Parameter | Direction | Description | -| ---------- | ---------- | -------------------------------------------------------- | -| vector | out | A pointer to a vector which coordinated must be set to 0 | +| Parameter | Direction | Description | +| --------- | --------- | -------------------------------------------------------- | +| vector | out | A pointer to a vector which coordinated must be set to 0 | You should pass only valid pointers in the parameter *vector*. The NULL (0) value is considered invalid. diff --git a/docs/vector3/reset-rus.md b/docs/vector3/reset-rus.md index 838cd16..e5ce4a6 100644 --- a/docs/vector3/reset-rus.md +++ b/docs/vector3/reset-rus.md @@ -2,21 +2,21 @@ [English version / Английская версия](reset-eng.md) -Функиция для **BGC_FP32_Vector3**: +Функция для **BGC_FP32_Vector3**: ```c inline void bgc_fp32_vector3_reset(BGC_FP32_Vector3* const vector); ``` -Функиция для **BGC_FP64_Vector3**: +Функция для **BGC_FP64_Vector3**: ```c inline void bgc_fp64_vector3_reset(BGC_FP64_Vector3* const vector); ``` -Данные функции устанавливают значения всех кооординат равным 0. +Данные функции устанавливают значения всех координат равным 0. -Каждая из функций соответствуют следуюим трём строкам кода: +Каждая из функций соответствуют следующим трём строкам кода: ```c vector->x = 0; @@ -30,7 +30,7 @@ vector->z = 0; | Параметр | Направление | Описание | | -------- | ----------- | -------------------------------------------------------------------- | -| vector | исходящий | Указатель на вектор, координаты которого должны быть установлены в 0 | +| vector | исходящий | Указатель на вектор, координаты которого должны быть установлены в 0 | Необходимо передавать только корректные указатели в параметр *vector*. Значение NULL (0) также считается некорректным.