Описания углов и небольшие правки в библиотеке
This commit is contained in:
parent
aa581a9b2b
commit
eaf12b0a08
13 changed files with 120 additions and 22 deletions
|
@ -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.
|
||||
|
|
|
@ -37,4 +37,4 @@
|
|||
есть мостики - функции преобразования типа.
|
||||
|
||||
Однако в библиотеке нет функций, которые используют для вычисления данные разных
|
||||
типов (*float* и *double* одновременно).
|
||||
типов (**float** и *double* одновременно).
|
|
@ -97,7 +97,7 @@
|
|||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -113,7 +113,7 @@
|
|||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -129,7 +129,7 @@
|
|||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -146,7 +146,7 @@
|
|||
<ConformanceMode>true</ConformanceMode>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -103,7 +103,7 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -118,7 +118,7 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -133,7 +133,7 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)basic-geometry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -148,13 +148,13 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="fp32_vector2_test.c" />
|
||||
<ClCompile Include="geometry_test.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
<ClCompile Include="sp_vector2_test.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="fp32_vector2_test.h" />
|
||||
<ClInclude Include="geometry_test.h" />
|
||||
<ClInclude Include="sp_vector2_test.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<ClCompile Include="geometry_test.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sp_vector2_test.c">
|
||||
<ClCompile Include="fp32_vector2_test.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<ClInclude Include="geometry_test.h">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sp_vector2_test.h">
|
||||
<ClInclude Include="fp32_vector2_test.h">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __GEOMETRY_TEST_H__
|
||||
#define __GEOMETRY_TEST_H__
|
||||
|
||||
#include <geometry.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
#define TEST_RESULT_SUCCES 0
|
||||
#define TEST_RESULT_FAILED 100
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <math.h>
|
||||
|
||||
#include "basis.h"
|
||||
#include "angle.h"
|
||||
#include "matrix3x3.h"
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "basis.h"
|
||||
#include "angle.h"
|
||||
#include "vector3.h"
|
||||
#include "rotation3.h"
|
||||
#include "matrix3x3.h"
|
||||
|
|
49
docs/english/Angle.md
Normal file
49
docs/english/Angle.md
Normal file
|
@ -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.
|
|
@ -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
|
||||
|
|
47
docs/russian/Angle.md
Normal file
47
docs/russian/Angle.md
Normal file
|
@ -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 для знакового диапазона значений.
|
|
@ -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**:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
- BgFP32Vector2 - вектор одинарной точности
|
||||
- BgFP64Vector2 - вектор двойной точности
|
||||
|
||||
Векторы типа BgFP32Vecto2 для хранения координат использует тип **float** (тип
|
||||
Векторы типа BgFP32Vector2 для хранения координат использует тип **float** (тип
|
||||
binary32 стандарта IEEE 754).
|
||||
|
||||
Векторы BgFP64Vector2 используют тип **double** (тип binary64 стандарта IEEE 754).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue