Удаление лишних файлов / Removing of extra and old files from the repository

This commit is contained in:
Andrey Pokidov 2024-11-22 16:48:50 +07:00
parent beb237fd4e
commit 985b1e0c84
49 changed files with 0 additions and 6855 deletions

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_layout_file>
<FileVersion major="1" minor="0" />
<ActiveProject path="basic-geometry-dev/basic-geometry-dev.cbp" />
<PreferredTarget name="Release" />
</CodeBlocks_workspace_layout_file>

View file

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="geometry-dev" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/geometry-dev" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
<Add directory="../src" />
</Compiler>
<Linker>
<Add library="geometry" />
<Add library="m" />
<Add directory="../src/bin/Debug" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/geometry-dev" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add directory="../src" />
</Compiler>
<Linker>
<Add option="-O2" />
<Add option="-s" />
<Add library="geometry" />
<Add library="m" />
<Add directory="../src/bin/Release" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="main.c">
<Option compilerVar="CC" />
</Unit>
<Extensions />
</Project>
</CodeBlocks_project_file>

View file

@ -1,126 +0,0 @@
# depslib dependency file v1.0
1732169779 source:/home/andrey/Projects/Private/C/Geometry/dev/main.c
<stdio.h>
<stdlib.h>
<math.h>
<geometry.h>
<windows.h>
<time.h>
1731906002 /home/andrey/Projects/Private/C/Geometry/src/geometry.h
"basis.h"
"angle.h"
"vector2.h"
"vector3.h"
"matrixes.h"
"matrix2x2.h"
"matrix2x3.h"
"matrix3x2.h"
"matrix3x3.h"
"rotation3.h"
"quaternion.h"
"versor.h"
1732094620 /home/andrey/Projects/Private/C/Geometry/src/basis.h
1732096335 /home/andrey/Projects/Private/C/Geometry/src/angle.h
<math.h>
"basis.h"
1732095049 /home/andrey/Projects/Private/C/Geometry/src/vector2.h
"basis.h"
"angle.h"
<math.h>
1732095097 /home/andrey/Projects/Private/C/Geometry/src/vector3.h
"basis.h"
"angle.h"
<math.h>
1729500312 /home/andrey/Projects/Private/C/Geometry/src/vector4.h
"basis.h"
"angle.h"
<math.h>
1732095748 /home/andrey/Projects/Private/C/Geometry/src/matrix2x2.h
"angle.h"
"vector2.h"
"matrixes.h"
1732095414 /home/andrey/Projects/Private/C/Geometry/src/matrix3x3.h
"vector3.h"
"matrixes.h"
1729490844 /home/andrey/Projects/Private/C/Geometry/src/matrix4x4.h
"vector4.h"
1729490850 /home/andrey/Projects/Private/C/Geometry/src/tangent.h
<math.h>
"basis.h"
"angle.h"
"vector2.h"
"matrix2x2.h"
1732095748 /home/andrey/Projects/Private/C/Geometry/src/rotation3.h
"basis.h"
"angle.h"
"vector3.h"
1732169837 /home/andrey/Projects/Private/C/Geometry/src/versor.h
<stdint.h>
"basis.h"
"vector3.h"
"rotation3.h"
"matrix3x3.h"
1729503008 /home/andrey/Projects/Private/C/Geometry/src/affine_map2.h
"vector2.h"
"matrix2x2.h"
1729502996 /home/andrey/Projects/Private/C/Geometry/src/affine_map3.h
"vector3.h"
"matrix3x3.h"
1729503020 /home/andrey/Projects/Private/C/Geometry/src/affine_map4.h
"vector4.h"
"matrix4x4.h"
1729426494 /home/andrey/Projects/Private/C/Geometry/src/cartesian-frame2.h
"vector2.h"
"tangent.h"
"affine_map2.h"
1729444022 /home/andrey/Projects/Private/C/Geometry/src/cartesian-frame3.h
<math.h>
"vector3.h"
"versor.h"
"affine_map3.h"
1729593024 /home/andrey/Projects/Private/C/Geometry/src/position2.h
"vector2.h"
"tangent.h"
"affine_map2.h"
1729593010 /home/andrey/Projects/Private/C/Geometry/src/position3.h
<math.h>
"vector3.h"
"versor.h"
"affine_map3.h"
1732094620 /home/andrey/Projects/Private/C/Geometry/src/matrixes.h
1732095530 /home/andrey/Projects/Private/C/Geometry/src/matrix2x3.h
"vector2.h"
"vector3.h"
"matrixes.h"
1732095530 /home/andrey/Projects/Private/C/Geometry/src/matrix3x2.h
"vector2.h"
"vector3.h"
"matrixes.h"
1732095234 /home/andrey/Projects/Private/C/Geometry/src/quaternion.h
<math.h>
"basis.h"
"matrix3x3.h"

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1168" topLine="46" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View file

@ -1,165 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\geometry.vcxproj">
<Project>{40ca6fb4-135f-4d54-a8d9-7338ba56e6a7}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{46de6c8f-3179-4652-95cf-28d44ac4774a}</ProjectGuid>
<RootNamespace>geometry-dev</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Исходные файлы">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Файлы заголовков">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Файлы ресурсов">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View file

@ -1,194 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <geometry.h>
#ifdef _WIN64
#include <windows.h>
#else
#include <time.h>
#endif // _WINDOWS_
BgFP32Versor * allocate_versors(const unsigned int amount)
{
return calloc(amount, sizeof(BgFP32Versor));
}
BgFP32Versor * make_zero_versors(const unsigned int amount)
{
BgFP32Versor * list = allocate_versors(amount);
if (list == 0) {
return 0;
}
for (unsigned int i = 0; i < amount; i++) {
bg_fp32_versor_reset(&list[i]);
}
return list;
}
BgFP32Versor * make_random_versors(const unsigned int amount)
{
BgFP32Versor * list = allocate_versors(amount);
if (list == 0) {
return 0;
}
for (unsigned int i = 0; i < amount; i++) {
bg_fp32_versor_set_values(
(2.0f * rand()) / RAND_MAX - 1.0f,
(2.0f * rand()) / RAND_MAX - 1.0f,
(2.0f * rand()) / RAND_MAX - 1.0f,
(2.0f * rand()) / RAND_MAX - 1.0f,
&list[i]
);
}
return list;
}
void print_versor(const BgFP32Versor* versor)
{
printf("(%f, %f, %f, %f)\n", versor->s0, versor->x1, versor->x2, versor->x3);
}
void print_vector(const BgFP32Vector3* vector)
{
printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, bg_fp32_vector3_get_module(vector));
}
/*
int main()
{
const unsigned int amount = 1000000;
#ifdef _WIN64
ULONGLONG now;
now = GetTickCount64();
srand((unsigned int)(now & 0xfffffff));
#else
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
srand((unsigned int)(now.tv_nsec & 0xfffffff));
#endif // _WIN64
BgFP32Versor * versors = make_random_versors(amount);
if (versors == 0) {
printf("Cannot allocate memory for versors");
return 0;
}
BgFP32Vector3 initial, result;
bg_fp32_vector3_set_values(1, 2, 3, &initial);
bg_fp32_vector3_copy(&initial, &result);
#ifdef _WIN64
ULONGLONG start, end;
start = GetTickCount64();
#else
struct timespec start, end;
clock_gettime(CLOCK_REALTIME, &start);
#endif // _WIN64
for (unsigned int i = 0; i < amount; i++) {
bg_fp32_versor_turn2(&versors[i], &result, &result);
}
for (unsigned int i = amount; i > 0; i--) {
bg_fp32_versor_turn_back2(&versors[i - 1], &result, &result);
}
#ifdef _WIN64
end = GetTickCount64();
printf("Time: %lld\n", end - start);
#else
clock_gettime(CLOCK_REALTIME, &end);
printf("Time: %lf\n", (end.tv_sec - start.tv_sec) * 1000.0 + (end.tv_nsec - start.tv_nsec) * 0.000001);
#endif // _WIN64
print_vector(&initial);
print_vector(&result);
free(versors);
return 0;
}
*/
int main()
{
const unsigned int amount = 1000000;
#ifdef _WIN64
ULONGLONG now;
now = GetTickCount64();
srand((unsigned int)(now & 0xfffffff));
#else
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
srand((unsigned int)(now.tv_nsec & 0xfffffff));
#endif // _WIN64
BgFP32Versor * versors1 = make_random_versors(amount);
if (versors1 == 0) {
printf("Cannot allocate memory for versors1");
return 0;
}
BgFP32Versor * versors2 = make_random_versors(amount);
if (versors2 == 0) {
printf("Cannot allocate memory for versors2");
free(versors1);
return 0;
}
BgFP32Versor * results = make_zero_versors(amount);
if (results == 0) {
printf("Cannot allocate memory for results");
free(versors2);
free(versors1);
return 0;
}
#ifdef _WIN64
ULONGLONG start, end;
start = GetTickCount64();
#else
struct timespec start, end;
clock_gettime(CLOCK_REALTIME, &start);
#endif // _WIN64
for (int j = 0; j < 1000; j++) {
for (unsigned int i = 0; i < amount; i++) {
bg_fp32_versor_combine(&versors1[i], &versors2[i], &results[i]);
}
}
#ifdef _WIN64
end = GetTickCount64();
printf("Time: %lld\n", end - start);
#else
clock_gettime(CLOCK_REALTIME, &end);
printf("Time: %lf\n", (end.tv_sec - start.tv_sec) * 1000.0 + (end.tv_nsec - start.tv_nsec) * 0.000001);
#endif // _WIN64
print_versor(versors1 + 10);
print_versor(versors2 + 10);
print_versor(results + 10);
free(results);
free(versors2);
free(versors1);
return 0;
}

View file

@ -1,3 +0,0 @@
#include "basis.h"
#include "angle.h"

View file

@ -1,557 +0,0 @@
#ifndef _GEOMETRY_ANGLE_H_
#define _GEOMETRY_ANGLE_H_
#include <math.h>
#include "basis.h"
#define BG_FP32_PI 3.1415926536f
#define BG_FP32_TWO_PI 6.2831853072f
#define BG_FP32_HALF_OF_PI 1.5707963268f
#define BG_FP32_THIRD_OF_PI 1.0471975512f
#define BG_FP32_FOURTH_OF_PI 0.7853981634f
#define BG_FP32_SIXTH_OF_PI 0.5235987756f
#define BG_FP32_DEGREES_IN_RADIAN 57.295779513f
#define BG_FP32_TURNS_IN_RADIAN 0.1591549431f
#define BG_FP32_RADIANS_IN_DEGREE 1.745329252E-2f
#define BG_FP32_TURNS_IN_DEGREE 2.7777777778E-3f
#define BG_FP64_PI 3.14159265358979324
#define BG_FP64_TWO_PI 6.28318530717958648
#define BG_FP64_HALF_OF_PI 1.57079632679489662
#define BG_FP64_THIRD_OF_PI 1.04719755119659775
#define BG_FP64_FOURTH_OF_PI 0.78539816339744831
#define BG_FP64_SIXTH_OF_PI 0.523598775598298873
#define BG_FP64_DEGREES_IN_RADIAN 57.2957795130823209
#define BG_FP64_TURNS_IN_RADIAN 0.159154943091895336
#define BG_FP64_RADIANS_IN_DEGREE 1.74532925199432958E-2
#define BG_FP64_TURNS_IN_DEGREE 2.77777777777777778E-3
typedef enum {
BG_ANGLE_UNIT_RADIANS = 1,
BG_ANGLE_UNIT_DEGREES = 2,
BG_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
*/
BG_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
*/
BG_ANGLE_RANGE_SIGNED = 2
} angle_range_t;
// !================= Radians ==================! //
// ========= Convert radians to degrees ========= //
static inline float bg_fp32_radians_to_degrees(const float radians)
{
return radians * BG_FP32_DEGREES_IN_RADIAN;
}
static inline double bg_fp64_radians_to_degrees(const double radians)
{
return radians * BG_FP64_DEGREES_IN_RADIAN;
}
// ========== Convert radians to turns ========== //
static inline float bg_fp32_radians_to_turns(const float radians)
{
return radians * BG_FP32_TURNS_IN_RADIAN;
}
static inline double bg_fp64_radians_to_turns(const double radians)
{
return radians * BG_FP64_TURNS_IN_RADIAN;
}
// ========= Convert radians to any unit ======== //
static inline float bg_fp32_radians_to_units(const float radians, const angle_unit_t to_unit)
{
if (to_unit == BG_ANGLE_UNIT_DEGREES) {
return radians * BG_FP32_DEGREES_IN_RADIAN;
}
if (to_unit == BG_ANGLE_UNIT_TURNS) {
return radians * BG_FP32_TURNS_IN_RADIAN;
}
return radians;
}
static inline double bg_fp64_radians_to_units(const double radians, const angle_unit_t to_unit)
{
if (to_unit == BG_ANGLE_UNIT_DEGREES) {
return radians * BG_FP64_DEGREES_IN_RADIAN;
}
if (to_unit == BG_ANGLE_UNIT_TURNS) {
return radians * BG_FP64_TURNS_IN_RADIAN;
}
return radians;
}
// ============ Normalize radians ============= //
static inline float bg_fp32_radians_normalize(const float radians, const angle_range_t range)
{
if (range == BG_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= radians && radians < BG_FP32_TWO_PI) {
return radians;
}
}
else {
if (-BG_FP32_PI < radians && radians <= BG_FP32_PI) {
return radians;
}
}
float turns = radians * BG_FP32_TURNS_IN_RADIAN;
turns -= floorf(turns);
if (range == BG_ANGLE_RANGE_SIGNED && turns > 0.5f) {
turns -= 1.0f;
}
return turns * BG_FP32_TWO_PI;
}
static inline double bg_fp64_radians_normalize(const double radians, const angle_range_t range)
{
if (range == BG_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= radians && radians < BG_FP64_TWO_PI) {
return radians;
}
}
else {
if (-BG_FP64_PI < radians && radians <= BG_FP64_PI) {
return radians;
}
}
double turns = radians * BG_FP64_TURNS_IN_RADIAN;
turns -= floor(turns);
if (range == BG_ANGLE_RANGE_SIGNED && turns > 0.5) {
turns -= 1.0;
}
return turns * BG_FP64_TWO_PI;
}
// !================= Degrees ==================! //
// ========= Convert degrees to radians ========= //
static inline float bg_fp32_degrees_to_radians(const float degrees)
{
return degrees * BG_FP32_RADIANS_IN_DEGREE;
}
static inline double bg_fp64_degrees_to_radians(const double degrees)
{
return degrees * BG_FP64_RADIANS_IN_DEGREE;
}
// ========== Convert degrees to turns ========== //
static inline float bg_fp32_degrees_to_turns(const float radians)
{
return radians * BG_FP32_TURNS_IN_DEGREE;
}
static inline double bg_fp64_degrees_to_turns(const double radians)
{
return radians * BG_FP64_TURNS_IN_DEGREE;
}
// ========= Convert degreess to any unit ======== //
static inline float bg_fp32_degrees_to_units(const float degrees, const angle_unit_t to_unit)
{
if (to_unit == BG_ANGLE_UNIT_RADIANS) {
return degrees * BG_FP32_RADIANS_IN_DEGREE;
}
if (to_unit == BG_ANGLE_UNIT_TURNS) {
return degrees * BG_FP32_TURNS_IN_DEGREE;
}
return degrees;
}
static inline double bg_fp64_degrees_to_units(const double degrees, const angle_unit_t to_unit)
{
if (to_unit == BG_ANGLE_UNIT_RADIANS) {
return degrees * BG_FP64_RADIANS_IN_DEGREE;
}
if (to_unit == BG_ANGLE_UNIT_TURNS) {
return degrees * BG_FP64_TURNS_IN_DEGREE;
}
return degrees;
}
// ============ Normalize degrees ============= //
static inline float bg_fp32_degrees_normalize(const float degrees, const angle_range_t range)
{
if (range == BG_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= degrees && degrees < 360.0f) {
return degrees;
}
}
else {
if (-180.0f < degrees && degrees <= 180.0f) {
return degrees;
}
}
float turns = degrees * BG_FP32_TURNS_IN_DEGREE;
turns -= floorf(turns);
if (range == BG_ANGLE_RANGE_SIGNED && turns > 0.5f) {
turns -= 1.0f;
}
return turns * 360.0f;
}
static inline double bg_fp64_degrees_normalize(const double degrees, const angle_range_t range)
{
if (range == BG_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= degrees && degrees < 360.0) {
return degrees;
}
}
else {
if (-180.0 < degrees && degrees <= 180.0) {
return degrees;
}
}
double turns = degrees * BG_FP64_TURNS_IN_DEGREE;
turns -= floor(turns);
if (range == BG_ANGLE_RANGE_SIGNED && turns > 0.5) {
turns -= 1.0;
}
return turns * 360.0;
}
// !================== Turns ===================! //
// ========== Convert turns to radians ========== //
static inline float bg_fp32_turns_to_radians(const float turns)
{
return turns * BG_FP32_TWO_PI;
}
static inline double bg_fp64_turns_to_radians(const double turns)
{
return turns * BG_FP64_TWO_PI;
}
// ========== Convert turns to degrees ========== //
static inline float bg_fp32_turns_to_degrees(const float turns)
{
return turns * 360.0f;
}
static inline double bg_fp64_turns_to_degrees(const double turns)
{
return turns * 360.0;
}
// ========= Convert turns to any unit ======== //
static inline float bg_fp32_turns_to_units(const float turns, const angle_unit_t to_unit)
{
if (to_unit == BG_ANGLE_UNIT_RADIANS) {
return turns * BG_FP32_TWO_PI;
}
if (to_unit == BG_ANGLE_UNIT_DEGREES) {
return turns * 360.0f;
}
return turns;
}
static inline double bg_fp64_turns_to_units(const double turns, const angle_unit_t to_unit)
{
if (to_unit == BG_ANGLE_UNIT_RADIANS) {
return turns * BG_FP64_TWO_PI;
}
if (to_unit == BG_ANGLE_UNIT_DEGREES) {
return turns * 360.0;
}
return turns;
}
// ============= Normalize turns ============== //
static inline float bg_fp32_turns_normalize(const float turns, const angle_range_t range)
{
if (range == BG_ANGLE_RANGE_UNSIGNED) {
if (0.0f <= turns && turns < 1.0f) {
return turns;
}
}
else {
if (-0.5f < turns && turns <= 0.5f) {
return turns;
}
}
float rest = turns - floorf(turns);
if (range == BG_ANGLE_RANGE_SIGNED && rest > 0.5f) {
return rest - 1.0f;
}
return rest;
}
static inline double bg_fp64_turns_normalize(const double turns, const angle_range_t range)
{
if (range == BG_ANGLE_RANGE_UNSIGNED) {
if (0.0 <= turns && turns < 1.0) {
return turns;
}
}
else {
if (-0.5 < turns && turns <= 0.5) {
return turns;
}
}
double rest = turns - floor(turns);
if (range == BG_ANGLE_RANGE_SIGNED && rest > 0.5) {
return rest - 1.0;
}
return rest;
}
// !================== Angle ===================! //
// ========= Convert any unit to radians ======== //
static inline float bg_fp32_angle_to_radians(const float angle, const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return angle * BG_FP32_RADIANS_IN_DEGREE;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return angle * BG_FP32_TWO_PI;
}
return angle;
}
static inline double bg_fp64_angle_to_radians(const double angle, const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return angle * BG_FP64_RADIANS_IN_DEGREE;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return angle * BG_FP64_TWO_PI;
}
return angle;
}
// ========= Convert any unit to degreess ======== //
static inline float bg_fp32_angle_to_degrees(const float angle, const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_RADIANS) {
return angle * BG_FP32_DEGREES_IN_RADIAN;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return angle * 360.0f;
}
return angle;
}
static inline double bg_fp64_angle_to_degrees(const double angle, const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_RADIANS) {
return angle * BG_FP64_DEGREES_IN_RADIAN;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return angle * 360.0;
}
return angle;
}
// ========= Convert any unit to turns ======== //
static inline float bg_fp32_angle_to_turns(const float angle, const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_RADIANS) {
return angle * BG_FP32_TURNS_IN_RADIAN;
}
if (unit == BG_ANGLE_UNIT_DEGREES) {
return angle * BG_FP32_TURNS_IN_DEGREE;
}
return angle;
}
static inline double bg_fp64_angle_to_turns(const double angle, const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_RADIANS) {
return angle * BG_FP64_TURNS_IN_RADIAN;
}
if (unit == BG_ANGLE_UNIT_DEGREES) {
return angle * BG_FP64_TURNS_IN_DEGREE;
}
return angle;
}
// ============= Get Full Circle ============== //
static inline float bg_fp32_angle_get_full_circle(const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return 360.0f;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return 1.0f;
}
return BG_FP32_TWO_PI;
}
static inline double bg_fp64_angle_get_full_circle(const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return 360.0;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return 1.0;
}
return BG_FP64_TWO_PI;
}
// ============= Get Half Circle ============== //
static inline float bg_fp32_angle_get_half_circle(const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return 180.0f;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return 0.5f;
}
return BG_FP32_PI;
}
static inline double bg_fp64_angle_get_half_circle(const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return 180.0;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return 0.5;
}
return BG_FP64_PI;
}
// ============= Get Half Circle ============== //
static inline float bg_fp32_angle_get_quater_circle(const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return 90.0f;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return 0.25f;
}
return BG_FP32_HALF_OF_PI;
}
static inline double bg_fp64_angle_get_quater_circle(const angle_unit_t unit)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return 90.0;
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return 0.25;
}
return BG_FP64_HALF_OF_PI;
}
// ================ Normalize ================= //
static inline float bg_fp32_angle_normalize(const float angle, const angle_unit_t unit, const angle_range_t range)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return bg_fp32_degrees_normalize(angle, range);
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return bg_fp32_turns_normalize(angle, range);
}
return bg_fp32_radians_normalize(angle, range);
}
static inline double bg_fp64_angle_normalize(const double angle, const angle_unit_t unit, const angle_range_t range)
{
if (unit == BG_ANGLE_UNIT_DEGREES) {
return bg_fp64_degrees_normalize(angle, range);
}
if (unit == BG_ANGLE_UNIT_TURNS) {
return bg_fp64_turns_normalize(angle, range);
}
return bg_fp64_radians_normalize(angle, range);
}
#endif

View file

@ -1,2 +0,0 @@
#include "basis.h"

View file

@ -1,56 +0,0 @@
#ifndef __GEOMETRY__TYPES_H_
#define __GEOMETRY__TYPES_H_
#define BG_FP32_EPSYLON_EFFECTIVENESS_LIMIT 10.0f
#define BG_FP32_EPSYLON 5E-7f
#define BG_FP32_TWO_EPSYLON 1E-6f
#define BG_FP32_SQUARE_EPSYLON 2.5E-13f
#define BG_FP32_ONE_THIRD 0.333333333f
#define BG_FP32_ONE_SIXTH 0.166666667f
#define BG_FP32_ONE_NINETH 0.111111111f
#define BG_FP32_GOLDEN_RATIO_HIGH 1.618034f
#define BG_FP32_GOLDEN_RATIO_LOW 0.618034f
#define BG_FP64_EPSYLON_EFFECTIVENESS_LIMIT 10.0
#define BG_FP64_EPSYLON 5E-14
#define BG_FP64_TWO_EPSYLON 1E-13
#define BG_FP64_SQUARE_EPSYLON 2.5E-27
#define BG_FP64_ONE_THIRD 0.333333333333333333
#define BG_FP64_ONE_SIXTH 0.166666666666666667
#define BG_FP64_ONE_NINETH 0.111111111111111111
#define BG_FP64_GOLDEN_RATIO_HIGH 1.61803398874989485
#define BG_FP64_GOLDEN_RATIO_LOW 0.61803398874989485
static inline int bg_fp32_are_equal(const float value1, const float value2)
{
if (-BG_FP32_EPSYLON_EFFECTIVENESS_LIMIT < value1 && value1 < BG_FP32_EPSYLON_EFFECTIVENESS_LIMIT) {
return -BG_FP32_EPSYLON <= (value1 - value2) && (value1 - value2) <= BG_FP32_EPSYLON;
}
if (value1 < 0.0f) {
return (1.0f + BG_FP32_EPSYLON) * value2 <= value1 && (1.0f + BG_FP32_EPSYLON) * value1 <= value2;
}
return value2 <= value1 * (1.0f + BG_FP32_EPSYLON) && value1 <= value2 * (1.0f + BG_FP32_EPSYLON);
}
static inline int bg_fp64_are_equal(const double value1, const double value2)
{
if (-BG_FP64_EPSYLON_EFFECTIVENESS_LIMIT < value1 && value1 < BG_FP64_EPSYLON_EFFECTIVENESS_LIMIT) {
return -BG_FP64_EPSYLON <= (value1 - value2) && (value1 - value2) <= BG_FP64_EPSYLON;
}
if (value1 < 0.0) {
return (1.0 + BG_FP64_EPSYLON) * value2 <= value1 && (1.0 + BG_FP64_EPSYLON) * value1 <= value2;
}
return value2 <= value1 * (1.0 + BG_FP64_EPSYLON) && value1 <= value2 * (1.0 + BG_FP64_EPSYLON);
}
#endif

View file

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="geometry" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/geometry" prefix_auto="1" extension_auto="1" />
<Option working_dir="" />
<Option object_output="obj/Debug/" />
<Option type="2" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
</Compiler>
<Linker>
<Add library="c" />
<Add library="m" />
<LinkerExe value="CCompiler" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/geometry" prefix_auto="1" extension_auto="1" />
<Option working_dir="" />
<Option object_output="obj/Release/" />
<Option type="2" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="-march=corei7-avx" />
<Add option="-O3" />
<Add option="-Wall" />
</Compiler>
<Linker>
<Add option="-O3" />
<Add option="-s" />
<Add option="-static" />
<Add library="c" />
<Add library="m" />
<LinkerExe value="CCompiler" />
</Linker>
</Target>
</Build>
<Unit filename="angle.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="angle.h" />
<Unit filename="basis.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="basis.h" />
<Unit filename="geometry.h" />
<Unit filename="matrix2x2.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrix2x2.h" />
<Unit filename="matrix2x3.h" />
<Unit filename="matrix3x2.h" />
<Unit filename="matrix3x3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrix3x3.h" />
<Unit filename="matrixes.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrixes.h" />
<Unit filename="quaternion.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="quaternion.h" />
<Unit filename="rotation3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="rotation3.h" />
<Unit filename="vector2.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="vector2.h" />
<Unit filename="vector3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="vector3.h" />
<Unit filename="versor.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="versor.h" />
<Extensions />
</Project>
</CodeBlocks_project_file>

View file

@ -1 +0,0 @@
# depslib dependency file v1.0

View file

@ -1,22 +0,0 @@
#ifndef __GEOMETRY_H__
#define __GEOMETRY_H__
#include "basis.h"
#include "angle.h"
#include "vector2.h"
#include "vector3.h"
#include "matrixes.h"
#include "matrix2x2.h"
#include "matrix2x3.h"
#include "matrix3x2.h"
#include "matrix3x3.h"
#include "rotation3.h"
#include "quaternion.h"
#include "versor.h"
#endif

View file

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="geometry.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="316" topLine="0" />
</Cursor>
</File>
<File name="rotation3.c" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="128" topLine="0" />
</Cursor>
</File>
<File name="vector3.c" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1765" topLine="0" />
</Cursor>
</File>
<File name="matrix2x2.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2008" topLine="63" />
</Cursor>
</File>
<File name="matrix3x3.c" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4343" topLine="67" />
</Cursor>
</File>
<File name="angle.c" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="matrixes.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4418" topLine="54" />
</Cursor>
</File>
<File name="basis.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20" topLine="0" />
</Cursor>
</File>
<File name="vector3.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="quaternion.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4195" topLine="122" />
</Cursor>
</File>
<File name="vector2.c" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1765" topLine="17" />
</Cursor>
</File>
<File name="angle.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="12295" topLine="509" />
</Cursor>
</File>
<File name="matrix2x2.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="24" topLine="0" />
</Cursor>
</File>
<File name="versor.h" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3483" topLine="119" />
</Cursor>
</File>
<File name="matrix3x2.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2291" topLine="280" />
</Cursor>
</File>
<File name="vector2.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2044" topLine="216" />
</Cursor>
</File>
<File name="versor.c" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1316" topLine="90" />
</Cursor>
</File>
<File name="matrix3x3.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="99" />
</Cursor>
</File>
<File name="rotation3.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2552" topLine="44" />
</Cursor>
</File>
<File name="basis.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1382" topLine="6" />
</Cursor>
</File>
<File name="matrix2x3.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2817" topLine="324" />
</Cursor>
</File>
<File name="quaternion.c" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1596" topLine="2" />
</Cursor>
</File>
<File name="matrixes.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="11981" topLine="205" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View file

@ -1,181 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="angle.h" />
<ClInclude Include="basis.h" />
<ClInclude Include="geometry.h" />
<ClInclude Include="matrix2x2.h" />
<ClInclude Include="matrix2x3.h" />
<ClInclude Include="matrix3x2.h" />
<ClInclude Include="matrix3x3.h" />
<ClInclude Include="matrixes.h" />
<ClInclude Include="quaternion.h" />
<ClInclude Include="rotation3.h" />
<ClInclude Include="versor.h" />
<ClInclude Include="vector2.h" />
<ClInclude Include="vector3.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="angle.c" />
<ClCompile Include="basis.c" />
<ClCompile Include="matrix2x2.c" />
<ClCompile Include="matrix2x3.c" />
<ClCompile Include="matrix3x2.c" />
<ClCompile Include="matrix3x3.c" />
<ClCompile Include="matrixes.c" />
<ClCompile Include="quaternion.c" />
<ClCompile Include="rotation3.c" />
<ClCompile Include="versor.c" />
<ClCompile Include="vector2.c" />
<ClCompile Include="vector3.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{40ca6fb4-135f-4d54-a8d9-7338ba56e6a7}</ProjectGuid>
<RootNamespace>geometry</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,96 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Исходные файлы">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Файлы заголовков">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Файлы ресурсов">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="angle.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="basis.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="geometry.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="matrix2x2.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="matrix3x3.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="rotation3.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="versor.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="vector2.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="vector3.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="quaternion.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="matrix2x3.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="matrix3x2.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="matrixes.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="angle.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="basis.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="matrix2x2.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="matrix3x3.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="versor.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="vector2.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="vector3.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="rotation3.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="quaternion.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="matrixes.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="matrix2x3.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="matrix3x2.c">
<Filter>Исходные файлы</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View file

@ -1 +0,0 @@
#include "matrix2x2.h"

View file

@ -1,488 +0,0 @@
#ifndef _GEOMETRY_MATRIX2X2_H_
#define _GEOMETRY_MATRIX2X2_H_
#include "angle.h"
#include "vector2.h"
#include "matrixes.h"
// =================== Reset ==================== //
static inline void bg_fp32_matrix2x2_reset(BgFP32Matrix2x2* matrix)
{
matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f;
matrix->r2c1 = 0.0f;
matrix->r2c2 = 0.0f;
}
static inline void bg_fp64_matrix2x2_reset(BgFP64Matrix2x2* matrix)
{
matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0;
matrix->r2c1 = 0.0;
matrix->r2c2 = 0.0;
}
// ================== Identity ================== //
static inline void bg_fp32_matrix2x2_set_to_identity(BgFP32Matrix2x2* matrix)
{
matrix->r1c1 = 1.0f;
matrix->r1c2 = 0.0f;
matrix->r2c1 = 0.0f;
matrix->r2c2 = 1.0f;
}
static inline void bg_fp64_matrix2x2_set_to_identity(BgFP64Matrix2x2* matrix)
{
matrix->r1c1 = 1.0;
matrix->r1c2 = 0.0;
matrix->r2c1 = 0.0;
matrix->r2c2 = 1.0;
}
// ================ Make Diagonal =============== //
static inline void bg_fp32_matrix2x2_set_to_diagonal(const float d1, const float d2, BgFP32Matrix2x2* matrix)
{
matrix->r1c1 = d1;
matrix->r1c2 = 0.0f;
matrix->r2c1 = 0.0f;
matrix->r2c2 = d2;
}
static inline void bg_fp64_matrix2x2_set_to_diagonal(const double d1, const double d2, BgFP64Matrix2x2* matrix)
{
matrix->r1c1 = d1;
matrix->r1c2 = 0.0;
matrix->r2c1 = 0.0;
matrix->r2c2 = d2;
}
// ============== Rotation Matrix =============== //
static inline void bg_fp32_matrix2x2_make_turn(const float angle, const angle_unit_t unit, BgFP32Matrix2x2* matrix)
{
const float radians = bg_fp32_angle_to_radians(angle, unit);
const float cosine = cosf(radians);
const float sine = sinf(radians);
matrix->r1c1 = cosine;
matrix->r1c2 = -sine;
matrix->r2c1 = sine;
matrix->r2c2 = cosine;
}
static inline void bg_fp64_matrix2x2_make_turn(const double angle, const angle_unit_t unit, BgFP64Matrix2x2* matrix)
{
const double radians = bg_fp64_angle_to_radians(angle, unit);
const double cosine = cos(radians);
const double sine = sin(radians);
matrix->r1c1 = cosine;
matrix->r1c2 = -sine;
matrix->r2c1 = sine;
matrix->r2c2 = cosine;
}
// ==================== Copy ==================== //
static inline void bg_fp32_matrix2x2_copy(const BgFP32Matrix2x2* from, BgFP32Matrix2x2* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2;
to->r2c1 = from->r2c1;
to->r2c2 = from->r2c2;
}
static inline void bg_fp64_matrix2x2_copy(const BgFP64Matrix2x2* from, BgFP64Matrix2x2* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2;
to->r2c1 = from->r2c1;
to->r2c2 = from->r2c2;
}
// ============= Copy to twin type ============== //
static inline void bg_fp32_matrix2x2_set_from_fp64(const BgFP64Matrix2x2* from, BgFP32Matrix2x2* to)
{
to->r1c1 = (float)from->r1c1;
to->r1c2 = (float)from->r1c2;
to->r2c1 = (float)from->r2c1;
to->r2c2 = (float)from->r2c2;
}
static inline void bg_fp64_matrix2x2_set_from_fp32(const BgFP32Matrix2x2* from, BgFP64Matrix2x2* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2;
to->r2c1 = from->r2c1;
to->r2c2 = from->r2c2;
}
// ================ Determinant ================= //
static inline float bg_fp32_matrix2x2_get_determinant(const BgFP32Matrix2x2* matrix)
{
return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
}
static inline double bg_fp64_matrix2x2_get_determinant(const BgFP64Matrix2x2* matrix)
{
return matrix->r1c1 * matrix->r2c2 - matrix->r1c2 * matrix->r2c1;
}
// ================== Singular ================== //
static inline int bg_fp32_matrix2x2_is_singular(const BgFP32Matrix2x2* matrix)
{
const float determinant = bg_fp32_matrix2x2_get_determinant(matrix);
return -BG_FP32_EPSYLON <= determinant && determinant <= BG_FP32_EPSYLON;
}
static inline int bg_fp64_matrix2x2_is_singular(const BgFP64Matrix2x2* matrix)
{
const double determinant = bg_fp64_matrix2x2_get_determinant(matrix);
return -BG_FP64_EPSYLON <= determinant && determinant <= BG_FP64_EPSYLON;
}
// =============== Transposition ================ //
static inline void bg_fp32_matrix2x2_transpose(BgFP32Matrix2x2* matrix)
{
const float tmp = matrix->r1c2;
matrix->r1c2 = matrix->r2c1;
matrix->r2c1 = tmp;
}
static inline void bg_fp64_matrix2x2_transpose(BgFP64Matrix2x2* matrix)
{
const double tmp = matrix->r1c2;
matrix->r1c2 = matrix->r2c1;
matrix->r2c1 = tmp;
}
// ================= Inversion ================== //
static inline int bg_fp32_matrix2x2_invert(BgFP32Matrix2x2* matrix)
{
const float determinant = bg_fp32_matrix2x2_get_determinant(matrix);
if (-BG_FP32_EPSYLON <= determinant && determinant <= BG_FP32_EPSYLON) {
return 0;
}
const float r1c1 = matrix->r2c2;
const float r1c2 = -matrix->r1c2;
const float r2c1 = -matrix->r2c1;
const float r2c2 = matrix->r1c1;
matrix->r1c1 = r1c1 / determinant;
matrix->r1c2 = r1c2 / determinant;
matrix->r2c1 = r2c1 / determinant;
matrix->r2c2 = r2c2 / determinant;
return 1;
}
static inline int bg_fp64_matrix2x2_invert(BgFP64Matrix2x2* matrix)
{
const double determinant = bg_fp64_matrix2x2_get_determinant(matrix);
if (-BG_FP64_EPSYLON <= determinant && determinant <= BG_FP64_EPSYLON) {
return 0;
}
const double r1c1 = matrix->r2c2;
const double r1c2 = -matrix->r1c2;
const double r2c1 = -matrix->r2c1;
const double r2c2 = matrix->r1c1;
matrix->r1c1 = r1c1 / determinant;
matrix->r1c2 = r1c2 / determinant;
matrix->r2c1 = r2c1 / determinant;
matrix->r2c2 = r2c2 / determinant;
return 1;
}
// =============== Set Transposed =============== //
static inline void bg_fp32_matrix2x2_set_transposed(const BgFP32Matrix2x2* from, BgFP32Matrix2x2* to)
{
float tmp = from->r1c2;
to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1;
to->r2c1 = tmp;
to->r2c2 = from->r2c2;
}
static inline void bg_fp64_matrix2x2_set_transposed(const BgFP64Matrix2x2* from, BgFP64Matrix2x2* to)
{
double tmp = from->r1c2;
to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1;
to->r2c1 = tmp;
to->r2c2 = from->r2c2;
}
// ================ Set Inverted ================ //
static inline int bg_fp32_matrix2x2_set_inverted(const BgFP32Matrix2x2* from, BgFP32Matrix2x2* to)
{
const float determinant = bg_fp32_matrix2x2_get_determinant(from);
if (-BG_FP32_EPSYLON <= determinant && determinant <= BG_FP32_EPSYLON) {
return 0;
}
const float r1c1 = from->r2c2;
const float r1c2 = -from->r1c2;
const float r2c1 = -from->r2c1;
const float r2c2 = from->r1c1;
to->r1c1 = r1c1 / determinant;
to->r1c2 = r1c2 / determinant;
to->r2c1 = r2c1 / determinant;
to->r2c2 = r2c2 / determinant;
return 1;
}
static inline int bg_fp64_matrix2x2_set_inverted(const BgFP64Matrix2x2* from, BgFP64Matrix2x2* to)
{
const double determinant = bg_fp64_matrix2x2_get_determinant(from);
if (-BG_FP64_EPSYLON <= determinant && determinant <= BG_FP64_EPSYLON) {
return 0;
}
const double r1c1 = from->r2c2;
const double r1c2 = -from->r1c2;
const double r2c1 = -from->r2c1;
const double r2c2 = from->r1c1;
to->r1c1 = r1c1 / determinant;
to->r1c2 = r1c2 / determinant;
to->r2c1 = r2c1 / determinant;
to->r2c2 = r2c2 / determinant;
return 1;
}
// ================= Set Row 1 ================== //
static inline void bg_fp32_matrix2x2_set_row1(const float c1, const float c2, BgFP32Matrix2x2* matrix)
{
matrix->r1c1 = c1;
matrix->r1c2 = c2;
}
static inline void bg_fp64_matrix2x2_set_row1(const double c1, const double c2, BgFP64Matrix2x2* matrix)
{
matrix->r1c1 = c1;
matrix->r1c2 = c2;
}
// ================= Set Row 2 ================== //
static inline void bg_fp32_matrix2x2_set_row2(const float c1, const float c2, BgFP32Matrix2x2* matrix)
{
matrix->r2c1 = c1;
matrix->r2c2 = c2;
}
static inline void bg_fp64_matrix2x2_set_row2(const double c1, const double c2, BgFP64Matrix2x2* matrix)
{
matrix->r2c1 = c1;
matrix->r2c2 = c2;
}
// ================ Set Column 1 ================ //
static inline void bg_fp32_matrix2x2_set_column1(const float r1, const float r2, BgFP32Matrix2x2* matrix)
{
matrix->r1c1 = r1;
matrix->r2c1 = r2;
}
static inline void bg_fp64_matrix2x2_set_column1(const double r1, const double r2, BgFP64Matrix2x2* matrix)
{
matrix->r1c1 = r1;
matrix->r2c1 = r2;
}
// ================ Set Column 2 ================ //
static inline void bg_fp32_matrix2x2_set_column2(const float r1, const float r2, BgFP32Matrix2x2* matrix)
{
matrix->r1c2 = r1;
matrix->r2c2 = r2;
}
static inline void bg_fp64_matrix2x2_set_column2(const double r1, const double r2, BgFP64Matrix2x2* matrix)
{
matrix->r1c2 = r1;
matrix->r2c2 = r2;
}
// ================ Append scaled =============== //
static inline void bg_fp32_matrix2x2_append_scaled(BgFP32Matrix2x2* basic_vector, const BgFP32Matrix2x2* scalable_vector, const float scale)
{
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
}
static inline void bg_fp64_matrix2x2_append_scaled(BgFP64Matrix2x2* basic_vector, const BgFP64Matrix2x2* scalable_vector, const double scale)
{
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
}
// ================== Addition ================== //
static inline void bg_fp32_matrix2x2_add(const BgFP32Matrix2x2* matrix1, const BgFP32Matrix2x2* matrix2, BgFP32Matrix2x2* sum)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
}
static inline void bg_fp64_matrix2x2_add(const BgFP64Matrix2x2* matrix1, const BgFP64Matrix2x2* matrix2, BgFP64Matrix2x2* sum)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
}
// ================ Subtraction ================= //
static inline void bg_fp32_matrix2x2_subtract(const BgFP32Matrix2x2* minuend, const BgFP32Matrix2x2* subtrahend, BgFP32Matrix2x2* difference)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
}
static inline void bg_fp64_matrix2x2_subtract(const BgFP64Matrix2x2* minuend, const BgFP64Matrix2x2* subtrahend, BgFP64Matrix2x2* difference)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
}
// =============== Multiplication =============== //
static inline void bg_fp32_matrix2x2_multiply(const BgFP32Matrix2x2* multiplicand, const float multiplier, BgFP32Matrix2x2* product)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
product->r2c1 = multiplicand->r2c1 * multiplier;
product->r2c2 = multiplicand->r2c2 * multiplier;
}
static inline void bg_fp64_matrix2x2_multiply(const BgFP64Matrix2x2* multiplicand, const double multiplier, BgFP64Matrix2x2* product)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
product->r2c1 = multiplicand->r2c1 * multiplier;
product->r2c2 = multiplicand->r2c2 * multiplier;
}
// ================== Division ================== //
static inline void bg_fp32_matrix2x2_divide(const BgFP32Matrix2x2* dividend, const float divisor, BgFP32Matrix2x2* quotient)
{
quotient->r1c1 = dividend->r1c1 / divisor;
quotient->r1c2 = dividend->r1c2 / divisor;
quotient->r2c1 = dividend->r2c1 / divisor;
quotient->r2c2 = dividend->r2c2 / divisor;
}
static inline void bg_fp64_matrix2x2_divide(const BgFP64Matrix2x2* dividend, const double divisor, BgFP64Matrix2x2* quotient)
{
quotient->r1c1 = dividend->r1c1 / divisor;
quotient->r1c2 = dividend->r1c2 / divisor;
quotient->r2c1 = dividend->r2c1 / divisor;
quotient->r2c2 = dividend->r2c2 / divisor;
}
// ============ Left Vector Product ============= //
static inline void bg_fp32_matrix2x2_left_product(const BgFP32Vector2* vector, const BgFP32Matrix2x2* matrix, BgFP32Vector2* result)
{
bg_fp32_vector2_set_values(
vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1,
vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2,
result
);
}
static inline void bg_fp64_matrix2x2_left_product(const BgFP64Vector2* vector, const BgFP64Matrix2x2* matrix, BgFP64Vector2* result)
{
bg_fp64_vector2_set_values(
vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1,
vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2,
result
);
}
// ============ Right Vector Product ============ //
static inline void bg_fp32_matrix2x2_right_product(const BgFP32Matrix2x2* matrix, const BgFP32Vector2* vector, BgFP32Vector2* result)
{
bg_fp32_vector2_set_values(
matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2,
matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2,
result
);
}
static inline void bg_fp64_matrix2x2_right_product(const BgFP64Matrix2x2* matrix, const BgFP64Vector2* vector, BgFP64Vector2* result)
{
bg_fp64_vector2_set_values(
matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2,
matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2,
result
);
}
#endif

View file

@ -1,2 +0,0 @@
#include "matrix2x3.h"

View file

@ -1,372 +0,0 @@
#ifndef _GEOMETRY_MATRIX2X3_H_
#define _GEOMETRY_MATRIX2X3_H_
#include "vector2.h"
#include "vector3.h"
#include "matrixes.h"
// =================== Reset ==================== //
static inline void bg_fp32_matrix2x3_reset(BgFP32Matrix2x3* matrix)
{
matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f;
matrix->r2c1 = 0.0f;
matrix->r2c2 = 0.0f;
matrix->r3c1 = 0.0f;
matrix->r3c2 = 0.0f;
}
static inline void bg_fp64_matrix2x3_reset(BgFP64Matrix2x3* matrix)
{
matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0;
matrix->r2c1 = 0.0;
matrix->r2c2 = 0.0;
matrix->r3c1 = 0.0;
matrix->r3c2 = 0.0;
}
// ==================== Copy ==================== //
static inline void bg_fp32_matrix2x3_copy(const BgFP32Matrix2x3* from, BgFP32Matrix2x3* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2;
to->r2c1 = from->r2c1;
to->r2c2 = from->r2c2;
to->r3c1 = from->r3c1;
to->r3c2 = from->r3c2;
}
static inline void bg_fp64_matrix2x3_copy(const BgFP64Matrix2x3* from, BgFP64Matrix2x3* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2;
to->r2c1 = from->r2c1;
to->r2c2 = from->r2c2;
to->r3c1 = from->r3c1;
to->r3c2 = from->r3c2;
}
// ============= Copy to twin type ============== //
static inline void bg_fp32_matrix2x3_set_from_fp64(const BgFP64Matrix2x3* from, BgFP32Matrix2x3* to)
{
to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r1c2;
to->r2c1 = (float) from->r2c1;
to->r2c2 = (float) from->r2c2;
to->r3c1 = (float) from->r3c1;
to->r3c2 = (float) from->r3c2;
}
static inline void bg_fp64_matrix2x3_set_from_fp32(const BgFP32Matrix2x3* from, BgFP64Matrix2x3* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2;
to->r2c1 = from->r2c1;
to->r2c2 = from->r2c2;
to->r3c1 = from->r3c1;
to->r3c2 = from->r3c2;
}
// =============== Set transposed =============== //
static inline void bg_fp32_matrix2x3_set_transposed(const BgFP32Matrix3x2* from, BgFP32Matrix2x3* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1;
to->r2c1 = from->r1c2;
to->r2c2 = from->r2c2;
to->r3c1 = from->r1c3;
to->r3c2 = from->r2c3;
}
static inline void bg_fp64_matrix2x3_set_transposed(const BgFP64Matrix3x2* from, BgFP64Matrix2x3* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1;
to->r2c1 = from->r1c2;
to->r2c2 = from->r2c2;
to->r3c1 = from->r1c3;
to->r3c2 = from->r2c3;
}
// =============== Set transposed =============== //
static inline void bg_fp32_matrix2x3_set_transposed_fp64(const BgFP64Matrix3x2* from, BgFP32Matrix2x3* to)
{
to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r2c1;
to->r2c1 = (float) from->r1c2;
to->r2c2 = (float) from->r2c2;
to->r3c1 = (float) from->r1c3;
to->r3c2 = (float) from->r2c3;
}
static inline void bg_fp64_matrix2x3_set_transposed_fp32(const BgFP32Matrix3x2* from, BgFP64Matrix2x3* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1;
to->r2c1 = from->r1c2;
to->r2c2 = from->r2c2;
to->r3c1 = from->r1c3;
to->r3c2 = from->r2c3;
}
// ================= Set Row 1 ================== //
static inline void bg_fp32_matrix2x3_set_row1(const float c1, const float c2, BgFP32Matrix2x3* matrix)
{
matrix->r1c1 = c1;
matrix->r1c2 = c2;
}
static inline void bg_fp64_matrix2x3_set_row1(const double c1, const double c2, BgFP64Matrix2x3* matrix)
{
matrix->r1c1 = c1;
matrix->r1c2 = c2;
}
// ================= Set Row 2 ================== //
static inline void bg_fp32_matrix2x3_set_row2(const float c1, const float c2, BgFP32Matrix2x3* matrix)
{
matrix->r2c1 = c1;
matrix->r2c2 = c2;
}
static inline void bg_fp64_matrix2x3_set_row2(const double c1, const double c2, BgFP64Matrix2x3* matrix)
{
matrix->r2c1 = c1;
matrix->r2c2 = c2;
}
// ================= Set Row 3 ================== //
static inline void bg_fp32_matrix2x3_set_row3(const float c1, const float c2, BgFP32Matrix2x3* matrix)
{
matrix->r3c1 = c1;
matrix->r3c2 = c2;
}
static inline void bg_fp64_matrix2x3_set_row3(const double c1, const double c2, BgFP64Matrix2x3* matrix)
{
matrix->r3c1 = c1;
matrix->r3c2 = c2;
}
// ================ Set Column 1 ================ //
static inline void bg_fp32_matrix2x3_set_column1(const float r1, const float r2, const float r3, BgFP32Matrix2x3* matrix)
{
matrix->r1c1 = r1;
matrix->r2c1 = r2;
matrix->r3c1 = r3;
}
static inline void bg_fp64_matrix2x3_set_column1(const double r1, const double r2, const double r3, BgFP64Matrix2x3* matrix)
{
matrix->r1c1 = r1;
matrix->r2c1 = r2;
matrix->r3c1 = r3;
}
// ================ Set Column 2 ================ //
static inline void bg_fp32_matrix2x3_set_column2(const float r1, const float r2, const float r3, BgFP32Matrix2x3* matrix)
{
matrix->r1c2 = r1;
matrix->r2c2 = r2;
matrix->r3c2 = r3;
}
static inline void bg_fp64_matrix2x3_set_column2(const double r1, const double r2, const double r3, BgFP64Matrix2x3* matrix)
{
matrix->r1c2 = r1;
matrix->r2c2 = r2;
matrix->r3c2 = r3;
}
// ================ Append scaled =============== //
static inline void bg_fp32_matrix2x3_append_scaled(BgFP32Matrix2x3* basic_vector, const BgFP32Matrix2x3* scalable_vector, const float scale)
{
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
basic_vector->r3c1 += scalable_vector->r3c1 * scale;
basic_vector->r3c2 += scalable_vector->r3c2 * scale;
}
static inline void bg_fp64_matrix2x3_append_scaled(BgFP64Matrix2x3* basic_vector, const BgFP64Matrix2x3* scalable_vector, const double scale)
{
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
basic_vector->r3c1 += scalable_vector->r3c1 * scale;
basic_vector->r3c2 += scalable_vector->r3c2 * scale;
}
// ================== Addition ================== //
static inline void bg_fp32_matrix2x3_add(const BgFP32Matrix2x3* matrix1, const BgFP32Matrix2x3* matrix2, BgFP32Matrix2x3* sum)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
sum->r3c1 = matrix1->r3c1 + matrix2->r3c1;
sum->r3c2 = matrix1->r3c2 + matrix2->r3c2;
}
static inline void bg_fp64_matrix2x3_add(const BgFP64Matrix2x3* matrix1, const BgFP64Matrix2x3* matrix2, BgFP64Matrix2x3* sum)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
sum->r3c1 = matrix1->r3c1 + matrix2->r3c1;
sum->r3c2 = matrix1->r3c2 + matrix2->r3c2;
}
// ================ Subtraction ================= //
static inline void bg_fp32_matrix2x3_subtract(const BgFP32Matrix2x3* minuend, const BgFP32Matrix2x3* subtrahend, BgFP32Matrix2x3* difference)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
difference->r3c1 = minuend->r3c1 - subtrahend->r3c1;
difference->r3c2 = minuend->r3c2 - subtrahend->r3c2;
}
static inline void bg_fp64_matrix2x3_subtract(const BgFP64Matrix2x3* minuend, const BgFP64Matrix2x3* subtrahend, BgFP64Matrix2x3* difference)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
difference->r3c1 = minuend->r3c1 - subtrahend->r3c1;
difference->r3c2 = minuend->r3c2 - subtrahend->r3c2;
}
// =============== Multiplication =============== //
static inline void bg_fp32_matrix2x3_multiply(const BgFP32Matrix2x3* multiplicand, const float multiplier, BgFP32Matrix2x3* product)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
product->r2c1 = multiplicand->r2c1 * multiplier;
product->r2c2 = multiplicand->r2c2 * multiplier;
product->r3c1 = multiplicand->r3c1 * multiplier;
product->r3c2 = multiplicand->r3c2 * multiplier;
}
static inline void bg_fp64_matrix2x3_multiply(const BgFP64Matrix2x3* multiplicand, const double multiplier, BgFP64Matrix2x3* product)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
product->r2c1 = multiplicand->r2c1 * multiplier;
product->r2c2 = multiplicand->r2c2 * multiplier;
product->r3c1 = multiplicand->r3c1 * multiplier;
product->r3c2 = multiplicand->r3c2 * multiplier;
}
// ================== Division ================== //
static inline void bg_fp32_matrix2x3_divide(const BgFP32Matrix2x3* dividend, const float divisor, BgFP32Matrix2x3* quotient)
{
quotient->r1c1 = dividend->r1c1 / divisor;
quotient->r1c2 = dividend->r1c2 / divisor;
quotient->r2c1 = dividend->r2c1 / divisor;
quotient->r2c2 = dividend->r2c2 / divisor;
quotient->r3c1 = dividend->r3c1 / divisor;
quotient->r3c2 = dividend->r3c2 / divisor;
}
static inline void bg_fp64_matrix2x3_divide(const BgFP64Matrix2x3* dividend, const double divisor, BgFP64Matrix2x3* quotient)
{
quotient->r1c1 = dividend->r1c1 / divisor;
quotient->r1c2 = dividend->r1c2 / divisor;
quotient->r2c1 = dividend->r2c1 / divisor;
quotient->r2c2 = dividend->r2c2 / divisor;
quotient->r3c1 = dividend->r3c1 / divisor;
quotient->r3c2 = dividend->r3c2 / divisor;
}
// ============ Left Vector Product ============= //
static inline void bg_fp32_matrix2x3_left_product(const BgFP32Vector3* vector, const BgFP32Matrix2x3* matrix, BgFP32Vector2* result)
{
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1;
result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
}
static inline void bg_fp64_matrix2x3_left_product(const BgFP64Vector3* vector, const BgFP64Matrix2x3* matrix, BgFP64Vector2* result)
{
result->x1 = vector->x1 * matrix->r1c1 + vector->x2 * matrix->r2c1 + vector->x3 * matrix->r3c1;
result->x2 = vector->x1 * matrix->r1c2 + vector->x2 * matrix->r2c2 + vector->x3 * matrix->r3c2;
}
// ============ Right Vector Product ============ //
static inline void bg_fp32_matrix2x3_right_product(const BgFP32Matrix2x3* matrix, const BgFP32Vector2* vector, BgFP32Vector3* result)
{
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
result->x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2;
}
static inline void bg_fp64_matrix2x3_right_product(const BgFP64Matrix2x3* matrix, const BgFP64Vector2* vector, BgFP64Vector3* result)
{
result->x1 = matrix->r1c1 * vector->x1 + matrix->r1c2 * vector->x2;
result->x2 = matrix->r2c1 * vector->x1 + matrix->r2c2 * vector->x2;
result->x3 = matrix->r3c1 * vector->x1 + matrix->r3c2 * vector->x2;
}
#endif

View file

@ -1,2 +0,0 @@
#include "matrix3x2.h"

View file

Internal server error - Personal Git Server: Beyond coding. We Forge.

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -1,328 +0,0 @@
#ifndef _GEOMETRY_MATRIX3X2_H_
#define _GEOMETRY_MATRIX3X2_H_
#include "vector2.h"
#include "vector3.h"
#include "matrixes.h"
// =================== Reset ==================== //
static inline void bg_fp32_matrix3x2_reset(BgFP32Matrix3x2* matrix)
{
matrix->r1c1 = 0.0f;
matrix->r1c2 = 0.0f;
matrix->r1c3 = 0.0f;
matrix->r2c1 = 0.0f;
matrix->r2c2 = 0.0f;
matrix->r2c3 = 0.0f;
}
static inline void bg_fp64_matrix3x2_reset(BgFP64Matrix3x2* matrix)
{
matrix->r1c1 = 0.0;
matrix->r1c2 = 0.0;
matrix->r1c3 = 0.0;
matrix->r2c1 = 0.0;
matrix->r2c2 = 0.0;
matrix->r2c3 = 0.0;
}
// ============= Set from twin type ============= //
static inline void bg_fp32_matrix3x2_set_from_fp64(const BgFP64Matrix3x2* from, BgFP32Matrix3x2* to)
{
to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r1c2;
to->r1c3 = (float) from->r1c3;
to->r2c1 = (float) from->r2c1;
to->r2c2 = (float) from->r2c2;
to->r2c3 = (float) from->r2c3;
}
static inline void bg_fp64_matrix3x2_set_from_fp32(const BgFP32Matrix3x2* from, BgFP64Matrix3x2* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2;
to->r1c3 = from->r1c3;
to->r2c1 = from->r2c1;
to->r2c2 = from->r2c2;
to->r2c3 = from->r2c3;
}
// =============== Set transposed =============== //
static inline void bg_fp32_matrix3x2_set_transposed(const BgFP32Matrix2x3* from, BgFP32Matrix3x2* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1;
to->r1c3 = from->r3c1;
to->r2c1 = from->r1c2;
to->r2c2 = from->r2c2;
to->r2c3 = from->r3c2;
}
static inline void bg_fp64_matrix3x2_set_transposed(const BgFP64Matrix2x3* from, BgFP64Matrix3x2* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1;
to->r1c3 = from->r3c1;
to->r2c1 = from->r1c2;
to->r2c2 = from->r2c2;
to->r2c3 = from->r3c2;
}
// =============== Set transposed =============== //
static inline void bg_fp32_matrix3x2_set_transposed_fp64(const BgFP64Matrix2x3* from, BgFP32Matrix3x2* to)
{
to->r1c1 = (float) from->r1c1;
to->r1c2 = (float) from->r2c1;
to->r1c3 = (float) from->r3c1;
to->r2c1 = (float) from->r1c2;
to->r2c2 = (float) from->r2c2;
to->r2c3 = (float) from->r3c2;
}
static inline void bg_fp64_matrix3x2_set_transposed_fp32(const BgFP32Matrix2x3* from, BgFP64Matrix3x2* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r2c1;
to->r1c3 = from->r3c1;
to->r2c1 = from->r1c2;
to->r2c2 = from->r2c2;
to->r2c3 = from->r3c2;
}
// ================= Set Row 1 ================== //
static inline void bg_fp32_matrix3x2_set_row1(const float c1, const float c2, const float c3, BgFP32Matrix3x2* matrix)
{
matrix->r1c1 = c1;
matrix->r1c2 = c2;
matrix->r1c3 = c3;
}
static inline void bg_fp64_matrix3x2_set_row1(const double c1, const double c2, const double c3, BgFP64Matrix3x2* matrix)
{
matrix->r1c1 = c1;
matrix->r1c2 = c2;
matrix->r1c3 = c3;
}
// ================= Set Row 2 ================== //
static inline void bg_fp32_matrix3x2_set_row2(const float c1, const float c2, const float c3, BgFP32Matrix3x2* matrix)
{
matrix->r2c1 = c1;
matrix->r2c2 = c2;
matrix->r2c3 = c3;
}
static inline void bg_fp64_matrix3x2_set_row2(const double c1, const double c2, const double c3, BgFP64Matrix3x2* matrix)
{
matrix->r2c1 = c1;
matrix->r2c2 = c2;
matrix->r2c3 = c3;
}
// ================ Set Column 1 ================ //
static inline void bg_fp32_matrix3x2_set_column1(const float r1, const float r2, BgFP32Matrix3x2* matrix)
{
matrix->r1c1 = r1;
matrix->r2c1 = r2;
}
static inline void bg_fp64_matrix3x2_set_column1(const double r1, const double r2, BgFP64Matrix3x2* matrix)
{
matrix->r1c1 = r1;
matrix->r2c1 = r2;
}
// ================ Set Column 2 ================ //
static inline void bg_fp32_matrix3x2_set_column2(const float r1, const float r2, BgFP32Matrix3x2* matrix)
{
matrix->r1c2 = r1;
matrix->r2c2 = r2;
}
static inline void bg_fp64_matrix3x2_set_column2(const double r1, const double r2, BgFP64Matrix3x2* matrix)
{
matrix->r1c2 = r1;
matrix->r2c2 = r2;
}
// ================ Set Column 3 ================ //
static inline void bg_fp32_matrix3x2_set_column3(const float r1, const float r2, BgFP32Matrix3x2* matrix)
{
matrix->r1c3 = r1;
matrix->r2c3 = r2;
}
static inline void bg_fp64_matrix3x2_set_column3(const double r1, const double r2, BgFP64Matrix3x2* matrix)
{
matrix->r1c3 = r1;
matrix->r2c3 = r2;
}
// ================ Append scaled =============== //
static inline void bg_fp32_matrix3x2_append_scaled(BgFP32Matrix3x2* basic_vector, const BgFP32Matrix3x2* scalable_vector, const float scale)
{
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
basic_vector->r1c3 += scalable_vector->r1c3 * scale;
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
basic_vector->r2c3 += scalable_vector->r2c3 * scale;
}
static inline void bg_fp64_matrix3x2_append_scaled(BgFP64Matrix3x2* basic_vector, const BgFP64Matrix3x2* scalable_vector, const double scale)
{
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
basic_vector->r1c3 += scalable_vector->r1c3 * scale;
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
basic_vector->r2c3 += scalable_vector->r2c3 * scale;
}
// ================== Addition ================== //
static inline void bg_fp32_matrix3x2_add(const BgFP32Matrix3x2* matrix1, const BgFP32Matrix3x2* matrix2, BgFP32Matrix3x2* sum)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
sum->r1c3 = matrix1->r1c3 + matrix2->r1c3;
sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
}
static inline void bg_fp64_matrix3x2_add(const BgFP64Matrix3x2* matrix1, const BgFP64Matrix3x2* matrix2, BgFP64Matrix3x2* sum)
{
sum->r1c1 = matrix1->r1c1 + matrix2->r1c1;
sum->r1c2 = matrix1->r1c2 + matrix2->r1c2;
sum->r1c3 = matrix1->r1c3 + matrix2->r1c3;
sum->r2c1 = matrix1->r2c1 + matrix2->r2c1;
sum->r2c2 = matrix1->r2c2 + matrix2->r2c2;
sum->r2c3 = matrix1->r2c3 + matrix2->r2c3;
}
// ================ Subtraction ================= //
static inline void bg_fp32_matrix3x2_subtract(const BgFP32Matrix3x2* minuend, const BgFP32Matrix3x2* subtrahend, BgFP32Matrix3x2* difference)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
difference->r1c3 = minuend->r1c3 - subtrahend->r1c3;
difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
}
static inline void bg_fp64_matrix3x2_subtract(const BgFP64Matrix3x2* minuend, const BgFP64Matrix3x2* subtrahend, BgFP64Matrix3x2* difference)
{
difference->r1c1 = minuend->r1c1 - subtrahend->r1c1;
difference->r1c2 = minuend->r1c2 - subtrahend->r1c2;
difference->r1c3 = minuend->r1c3 - subtrahend->r1c3;
difference->r2c1 = minuend->r2c1 - subtrahend->r2c1;
difference->r2c2 = minuend->r2c2 - subtrahend->r2c2;
difference->r2c3 = minuend->r2c3 - subtrahend->r2c3;
}
// =============== Multiplication =============== //
static inline void bg_fp32_matrix3x2_multiply(const BgFP32Matrix3x2* multiplicand, const float multiplier, BgFP32Matrix3x2* product)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
product->r1c3 = multiplicand->r1c3 * multiplier;
product->r2c1 = multiplicand->r2c1 * multiplier;
product->r2c2 = multiplicand->r2c2 * multiplier;
product->r2c3 = multiplicand->r2c3 * multiplier;
}
static inline void bg_fp64_matrix3x2_multiply(const BgFP64Matrix3x2* multiplicand, const double multiplier, BgFP64Matrix3x2* product)
{
product->r1c1 = multiplicand->r1c1 * multiplier;
product->r1c2 = multiplicand->r1c2 * multiplier;
product->r1c3 = multiplicand->r1c3 * multiplier;
product->r2c1 = multiplicand->r2c1 * multiplier;
product->r2c2 = multiplicand->r2c2 * multiplier;
product->r2c3 = multiplicand->r2c3 * multiplier;
}
// ================== Division ================== //
static inline void bg_fp32_matrix3x2_divide(const BgFP32Matrix3x2* dividend, const float divisor, BgFP32Matrix3x2* quotient)
{
quotient->r1c1 = dividend->r1c1 / divisor;
quotient->r1c2 = dividend->r1c2 / divisor;
quotient->r1c3 = dividend->r1c3 / divisor;
quotient->r2c1 = dividend->r2c1 / divisor;
quotient->r2c2 = dividend->r2c2 / divisor;
quotient->r2c3 = dividend->r2c3 / divisor;
}
static inline void bg_fp64_matrix3x2_divide(const BgFP64Matrix3x2* dividend, const double divisor, BgFP64Matrix3x2* quotient)
{
quotient->r1c1 = dividend->r1c1 / divisor;