From eaf12b0a0804a5434cfac22387c22eb6beefe95e Mon Sep 17 00:00:00 2001 From: Andrey Pokidov Date: Sat, 23 Nov 2024 00:34:35 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=83=D0=B3=D0=BB=D0=BE=D0=B2=20=D0=B8=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8=20=D0=B2=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D0=BE=D1=82=D0=B5=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README-Eng.md | 4 +- README.md | 2 +- basic-geometry-dev/basic-geometry-dev.vcxproj | 8 +-- .../basic-geometry-test.vcxproj | 12 ++--- .../basic-geometry-test.vcxproj.filters | 4 +- basic-geometry-test/geometry_test.h | 2 +- basic-geometry/quaternion.h | 1 + basic-geometry/versor.h | 1 + docs/english/Angle.md | 49 +++++++++++++++++++ docs/english/Prefixes.md | 4 +- docs/russian/Angle.md | 47 ++++++++++++++++++ docs/russian/Prefixes.md | 6 +-- docs/russian/Vector2.md | 2 +- 13 files changed, 120 insertions(+), 22 deletions(-) create mode 100644 docs/english/Angle.md create mode 100644 docs/russian/Angle.md diff --git a/README-Eng.md b/README-Eng.md index 8f2dfdb..ea3c12b 100644 --- a/README-Eng.md +++ b/README-Eng.md @@ -36,5 +36,5 @@ functions of **float** type and another one is for date of th **double** type. And there are several bridges connect both of the halves. Those bridges are the functions of the type conversion. -But there are no functions which use data of different types (*float* and -*double* at the same time) for the computations. +But there are no functions which use data of different types (**float** and +**double** at the same time) for the computations. diff --git a/README.md b/README.md index 01b2cd5..43a5243 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,4 @@ есть мостики - функции преобразования типа. Однако в библиотеке нет функций, которые используют для вычисления данные разных -типов (*float* и *double* одновременно). \ No newline at end of file +типов (**float** и *double* одновременно). \ No newline at end of file diff --git a/basic-geometry-dev/basic-geometry-dev.vcxproj b/basic-geometry-dev/basic-geometry-dev.vcxproj index 125986d..c750cb1 100644 --- a/basic-geometry-dev/basic-geometry-dev.vcxproj +++ b/basic-geometry-dev/basic-geometry-dev.vcxproj @@ -97,7 +97,7 @@ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true CompileAsC - $(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories) Console @@ -113,7 +113,7 @@ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true CompileAsC - $(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories) Console @@ -129,7 +129,7 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true CompileAsC - $(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories) Console @@ -146,7 +146,7 @@ true CompileAsC MaxSpeed - $(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories) Neither Sync NotSet diff --git a/basic-geometry-test/basic-geometry-test.vcxproj b/basic-geometry-test/basic-geometry-test.vcxproj index 1283a6d..b5bf337 100644 --- a/basic-geometry-test/basic-geometry-test.vcxproj +++ b/basic-geometry-test/basic-geometry-test.vcxproj @@ -88,7 +88,7 @@ true WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - $(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories) Console @@ -103,7 +103,7 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - $(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories) Console @@ -118,7 +118,7 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - $(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories) Console @@ -133,7 +133,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - $(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories) Console @@ -148,13 +148,13 @@ + - + - diff --git a/basic-geometry-test/basic-geometry-test.vcxproj.filters b/basic-geometry-test/basic-geometry-test.vcxproj.filters index d7e4b49..df06490 100644 --- a/basic-geometry-test/basic-geometry-test.vcxproj.filters +++ b/basic-geometry-test/basic-geometry-test.vcxproj.filters @@ -21,7 +21,7 @@ Исходные файлы - + Исходные файлы @@ -29,7 +29,7 @@ Исходные файлы - + Исходные файлы diff --git a/basic-geometry-test/geometry_test.h b/basic-geometry-test/geometry_test.h index 5f9c868..c9d1740 100644 --- a/basic-geometry-test/geometry_test.h +++ b/basic-geometry-test/geometry_test.h @@ -1,7 +1,7 @@ #ifndef __GEOMETRY_TEST_H__ #define __GEOMETRY_TEST_H__ -#include +#include #define TEST_RESULT_SUCCES 0 #define TEST_RESULT_FAILED 100 diff --git a/basic-geometry/quaternion.h b/basic-geometry/quaternion.h index a44207a..20b6092 100644 --- a/basic-geometry/quaternion.h +++ b/basic-geometry/quaternion.h @@ -4,6 +4,7 @@ #include #include "basis.h" +#include "angle.h" #include "matrix3x3.h" typedef struct { diff --git a/basic-geometry/versor.h b/basic-geometry/versor.h index 03d397a..08f89a6 100644 --- a/basic-geometry/versor.h +++ b/basic-geometry/versor.h @@ -4,6 +4,7 @@ #include #include "basis.h" +#include "angle.h" #include "vector3.h" #include "rotation3.h" #include "matrix3x3.h" diff --git a/docs/english/Angle.md b/docs/english/Angle.md new file mode 100644 index 0000000..eb5147c --- /dev/null +++ b/docs/english/Angle.md @@ -0,0 +1,49 @@ +# Angles + +There are no structures for angles in the library. The library represents +angles as floating point numbers of types **float** and **double**. + +There are three units of measurement for angles in the library: +* radians (the full round is equal to 2∏ radians) +* degrees (the full round is equal to 360 degrees) +* turns (the full round is equal to 1 turn) + +The units of measurement of angles are defined with an enumerated type: + + typedef enum { + BG_ANGLE_UNIT_RADIANS = 1, + BG_ANGLE_UNIT_DEGREES = 2, + BG_ANGLE_UNIT_TURNS = 3 + } angle_unit_t; + + +* BG_ANGLE_UNIT_RADIANS is for measurement of angles in radians +* BG_ANGLE_UNIT_DEGREES is for measurement of angles in degrees +* BG_ANGLE_UNIT_TURNS is for measurement of angles in turns + +The functions of the library do not require angle values to be limited by any +range. But there are functions which can normalize angles to specific ranges. + +There are two ranges of normalized angles: a signed range and an unsigned +range. + +The unsigned range has no negative values. The unsigned range corresponds: +* [0, 2∏) radians +* [0, 360) degrees +* [0, 1) turns + +The signed range has both positive and negative values. The signed range +corresponds: +* (-∏, ∏] radians +* (-180, 180] degrees +* (-0.5, 0.5] turns + +The ranges of angles are defined with an enumerated type: + + typedef enum { + BG_ANGLE_RANGE_UNSIGNED = 1, + BG_ANGLE_RANGE_SIGNED = 2 + } angle_range_t; + +* BG_ANGLE_RANGE_UNSIGNED is for the unsigned range of values; +* BG_ANGLE_RANGE_SIGNED is for the signed range of values. diff --git a/docs/english/Prefixes.md b/docs/english/Prefixes.md index 3b64c35..3f2772f 100644 --- a/docs/english/Prefixes.md +++ b/docs/english/Prefixes.md @@ -19,10 +19,10 @@ 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 +* **FP32** - means **F**loating **P**oint, **32** bit, which corresponds to the **float** type of the C language. -* **FP32** - means **F**loating **P**oint 64 bit, which corresponds to the +* **FP32** - means **F**loating **P**oint, **64** bit, which corresponds to the **double** type of the C language. The types of structures which are based in the **float** type have **FP32** as diff --git a/docs/russian/Angle.md b/docs/russian/Angle.md new file mode 100644 index 0000000..b41bfa8 --- /dev/null +++ b/docs/russian/Angle.md @@ -0,0 +1,47 @@ +# Углы + +В библиотеке нет специальных структур для представления уголов. Функции +библиотеки работают с углами как с обычными числами с плавающей запятой +типов **float** и **double**. + +В библиотеке есть три единицы измерения уголов: +* радианы (полный оборот равен 2∏ радиан) +* градусы (полный оборот равен 360 градусов) +* обороты (полный оборот равен 1) + +Единицы измерения углов определены в перечилении: + + typedef enum { + BG_ANGLE_UNIT_RADIANS = 1, + BG_ANGLE_UNIT_DEGREES = 2, + BG_ANGLE_UNIT_TURNS = 3 + } angle_unit_t; + +Функции, которые принимают угол в качестве параметра, не требуют, чтобы +угол принадлежал какому-либо промежутку значений. Но в библиотеке есть +функции, которые могут нормализовать угол так, чтобы он находился в +нужном промежутке значений. + +Есть два промежутка нормализованных уголов: знаковый (singed) и беззнаковый +(unsigned). + +Беззнаковый диапазон не содержит отрицательных значений и соответствует: +[0, 2∏) радиан +[0, 360) градусов +[0, 1) оборотов + +Знаковый диапазон содержит как отрицательные, так и положительные значения. +Знаковый диапазон соответствует: +* (-∏, ∏] радиан +* (-180, 180] градусов +* (-0,5, 0,5] оборотов + +Диапазоны значений определены перечиляемым типом: + + typedef enum { + BG_ANGLE_RANGE_UNSIGNED = 1, + BG_ANGLE_RANGE_SIGNED = 2 + } angle_range_t; + +* BG_ANGLE_RANGE_UNSIGNED для беззнакового диапазона значений; +* BG_ANGLE_RANGE_SIGNED для знакового диапазона значений. diff --git a/docs/russian/Prefixes.md b/docs/russian/Prefixes.md index ade3263..7073508 100644 --- a/docs/russian/Prefixes.md +++ b/docs/russian/Prefixes.md @@ -2,7 +2,7 @@ Библиотека использует префиксы в названиях типов, констант и функций. -Основным префиксом является **BG** (сокращение от Basic Geometry / Базовая +Основным префиксом является **BG** (сокращение от **B**asic **G**eometry / Базовая Геометрия). Для структур данных префикс имеет вид **Bg**, например: BgFP64Vector3, @@ -20,10 +20,10 @@ bg_fp64_matrix3x3_subtract. Поэтому в библиотеке есть два префикса типа: -* **FP32** - означает **F**loating **P**oint 32 bit, то есть, число с +* **FP32** - означает **F**loating **P**oint **32** bit, то есть, число с плавающей запятой, 32 бита, что соответствует типу float языка Си. -* **FP64** - означает **F**loating **P**oint 64 bit, то есть, число с +* **FP64** - означает **F**loating **P**oint **64** bit, то есть, число с плавающей запятой, 64 бита, что соответствует типу double языка Си. Типы структур, использующие тип **float** имеют префикс типа в виде **FP32**: diff --git a/docs/russian/Vector2.md b/docs/russian/Vector2.md index 173edc4..7d2907b 100644 --- a/docs/russian/Vector2.md +++ b/docs/russian/Vector2.md @@ -4,7 +4,7 @@ - BgFP32Vector2 - вектор одинарной точности - BgFP64Vector2 - вектор двойной точности -Векторы типа BgFP32Vecto2 для хранения координат использует тип **float** (тип +Векторы типа BgFP32Vector2 для хранения координат использует тип **float** (тип binary32 стандарта IEEE 754). Векторы BgFP64Vector2 используют тип **double** (тип binary64 стандарта IEEE 754).