Базовая версия библиотеки. Версия 0.2.0-dev
This commit is contained in:
parent
b086af7f66
commit
6a56e85052
39 changed files with 6200 additions and 1 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -47,8 +47,14 @@
|
|||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
.vs
|
||||
x64
|
||||
x86
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
bin
|
||||
obj
|
||||
dev
|
||||
logs
|
||||
|
|
|
|||
12
Geometry.workspace
Normal file
12
Geometry.workspace
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_workspace_file>
|
||||
<Workspace title="Workspace">
|
||||
<Project filename="src/geometry.cbp" />
|
||||
<Project filename="dev/geometry-dev.cbp">
|
||||
<Depends filename="src/geometry.cbp" />
|
||||
</Project>
|
||||
<Project filename="test/geometry-test.cbp">
|
||||
<Depends filename="src/geometry.cbp" />
|
||||
</Project>
|
||||
</Workspace>
|
||||
</CodeBlocks_workspace_file>
|
||||
5
Geometry.workspace.layout
Normal file
5
Geometry.workspace.layout
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_workspace_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveProject path="dev/geometry-dev.cbp" />
|
||||
</CodeBlocks_workspace_layout_file>
|
||||
51
GeometryC.sln
Normal file
51
GeometryC.sln
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32421.90
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry", "src\geometry.vcxproj", "{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry-test", "test\geometry-test.vcxproj", "{48DAE315-715F-4044-ADF5-0308483B887C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry-dev", "dev\geometry-dev.vcxproj", "{46DE6C8F-3179-4652-95CF-28D44AC4774A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{48DAE315-715F-4044-ADF5-0308483B887C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{48DAE315-715F-4044-ADF5-0308483B887C}.Debug|x64.Build.0 = Debug|x64
|
||||
{48DAE315-715F-4044-ADF5-0308483B887C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{48DAE315-715F-4044-ADF5-0308483B887C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{48DAE315-715F-4044-ADF5-0308483B887C}.Release|x64.ActiveCfg = Release|x64
|
||||
{48DAE315-715F-4044-ADF5-0308483B887C}.Release|x64.Build.0 = Release|x64
|
||||
{48DAE315-715F-4044-ADF5-0308483B887C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{48DAE315-715F-4044-ADF5-0308483B887C}.Release|x86.Build.0 = Release|Win32
|
||||
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Debug|x64.Build.0 = Debug|x64
|
||||
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Debug|x86.Build.0 = Debug|Win32
|
||||
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Release|x64.ActiveCfg = Release|x64
|
||||
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Release|x64.Build.0 = Release|x64
|
||||
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Release|x86.ActiveCfg = Release|Win32
|
||||
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Release|x86.Build.0 = Release|Win32
|
||||
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Debug|x64.Build.0 = Debug|x64
|
||||
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Debug|x86.Build.0 = Debug|Win32
|
||||
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Release|x64.ActiveCfg = Release|x64
|
||||
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Release|x64.Build.0 = Release|x64
|
||||
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Release|x86.ActiveCfg = Release|Win32
|
||||
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {482D2212-4373-4231-88E5-34BD6B8CFF46}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
3
src/angle.c
Normal file
3
src/angle.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#include "basis.h"
|
||||
#include "angle.h"
|
||||
|
||||
549
src/angle.h
Normal file
549
src/angle.h
Normal file
|
|
@ -0,0 +1,549 @@
|
|||
#ifndef _GEOMETRY_ANGLE_H_
|
||||
#define _GEOMETRY_ANGLE_H_
|
||||
|
||||
#include <math.h>
|
||||
#include "basis.h"
|
||||
|
||||
#define SP_PI 3.1415926536f
|
||||
#define SP_TWO_PI 6.2831853072f
|
||||
#define SP_HALF_OF_PI 1.5707963268f
|
||||
#define SP_THIRD_OF_PI 1.0471975512f
|
||||
#define SP_FOURTH_OF_PI 0.7853981634f
|
||||
#define SP_SIXTH_OF_PI 0.5235987756f
|
||||
|
||||
#define SP_DEGREES_IN_RADIAN 57.295779513f
|
||||
#define SP_TURNS_IN_RADIAN 0.1591549431f
|
||||
#define SP_RADIANS_IN_DEGREE 1.745329252E-2f
|
||||
#define SP_TURNS_IN_DEGREE 2.7777777778E-3f
|
||||
|
||||
#define DP_PI 3.14159265358979324
|
||||
#define DP_TWO_PI 6.28318530717958648
|
||||
#define DP_HALF_OF_PI 1.57079632679489662
|
||||
#define DP_THIRD_OF_PI 1.04719755119659775
|
||||
#define DP_FOURTH_OF_PI 0.78539816339744831
|
||||
#define DP_SIXTH_OF_PI 0.523598775598298873
|
||||
|
||||
#define DP_DEGREES_IN_RADIAN 57.2957795130823209
|
||||
#define DP_TURNS_IN_RADIAN 0.159154943091895336
|
||||
#define DP_RADIANS_IN_DEGREE 1.74532925199432958E-2
|
||||
#define DP_TURNS_IN_DEGREE 2.77777777777777778E-3
|
||||
|
||||
typedef enum {
|
||||
ANGLE_UNIT_RADIANS = 1,
|
||||
ANGLE_UNIT_DEGREES = 2,
|
||||
ANGLE_UNIT_TURNS = 3
|
||||
} angle_unit_t;
|
||||
|
||||
typedef enum {
|
||||
/**
|
||||
* The measure of an angle with a range of:
|
||||
* [0, 360) degrees, [0, 2xPI) radians, [0, 1) turns, [0, 400) gradians
|
||||
*/
|
||||
ANGLE_RANGE_UNSIGNED = 1,
|
||||
|
||||
/**
|
||||
* The measure of an angle with a range of:
|
||||
* (-180, 180] degrees, (-PI, PI] radians, (-0.5, 0.5] turns, (-200, 200] gradians
|
||||
*/
|
||||
ANGLE_RANGE_SIGNED = 2
|
||||
} angle_range_t;
|
||||
|
||||
// ========= Convert radians to degrees ========= //
|
||||
|
||||
static inline float sp_radians_to_degrees(const float radians)
|
||||
{
|
||||
return radians * SP_DEGREES_IN_RADIAN;
|
||||
}
|
||||
|
||||