Добавлены матрицы 2x3 и 3x2, добавлены произведения матриц. Изменения в названиях функций

This commit is contained in:
Andrey Pokidov 2024-11-13 12:41:05 +07:00
parent 86486ac9cf
commit 049f09f3d4
31 changed files with 1831 additions and 1314 deletions

View file

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

View file

@ -1,51 +1,51 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.1.32421.90 VisualStudioVersion = 17.1.32421.90
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry", "src\geometry.vcxproj", "{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry", "src\geometry.vcxproj", "{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry-test", "test\geometry-test.vcxproj", "{48DAE315-715F-4044-ADF5-0308483B887C}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry-test", "test\geometry-test.vcxproj", "{48DAE315-715F-4044-ADF5-0308483B887C}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry-dev", "dev\geometry-dev.vcxproj", "{46DE6C8F-3179-4652-95CF-28D44AC4774A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geometry-dev", "dev\geometry-dev.vcxproj", "{46DE6C8F-3179-4652-95CF-28D44AC4774A}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
Release|x64 = Release|x64 Release|x64 = Release|x64
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{48DAE315-715F-4044-ADF5-0308483B887C}.Debug|x64.ActiveCfg = Debug|x64 {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|x64.Build.0 = Debug|x64
{48DAE315-715F-4044-ADF5-0308483B887C}.Debug|x86.ActiveCfg = Debug|Win32 {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}.Debug|x86.Build.0 = Debug|Win32
{48DAE315-715F-4044-ADF5-0308483B887C}.Release|x64.ActiveCfg = Release|x64 {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|x64.Build.0 = Release|x64
{48DAE315-715F-4044-ADF5-0308483B887C}.Release|x86.ActiveCfg = Release|Win32 {48DAE315-715F-4044-ADF5-0308483B887C}.Release|x86.ActiveCfg = Release|Win32
{48DAE315-715F-4044-ADF5-0308483B887C}.Release|x86.Build.0 = 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.ActiveCfg = Debug|x64
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Debug|x64.Build.0 = 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.ActiveCfg = Debug|Win32
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Debug|x86.Build.0 = 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.ActiveCfg = Release|x64
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Release|x64.Build.0 = 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.ActiveCfg = Release|Win32
{40CA6FB4-135F-4D54-A8D9-7338BA56E6A7}.Release|x86.Build.0 = 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.ActiveCfg = Debug|x64
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Debug|x64.Build.0 = 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.ActiveCfg = Debug|Win32
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Debug|x86.Build.0 = 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.ActiveCfg = Release|x64
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Release|x64.Build.0 = 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.ActiveCfg = Release|Win32
{46DE6C8F-3179-4652-95CF-28D44AC4774A}.Release|x86.Build.0 = Release|Win32 {46DE6C8F-3179-4652-95CF-28D44AC4774A}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {482D2212-4373-4231-88E5-34BD6B8CFF46} SolutionGuid = {482D2212-4373-4231-88E5-34BD6B8CFF46}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View file

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

View file

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

View file

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

View file

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

View file

@ -135,7 +135,7 @@ void print_matrix(const DPMatrix3x3* matrix)
printf("(%lf, %lf, %lf)\n", matrix->r2c1, matrix->r2c2, matrix->r2c3); printf("(%lf, %lf, %lf)\n", matrix->r2c1, matrix->r2c2, matrix->r2c3);
printf("(%lf, %lf, %lf)\n\n", matrix->r3c1, matrix->r3c2, matrix->r3c3); printf("(%lf, %lf, %lf)\n\n", matrix->r3c1, matrix->r3c2, matrix->r3c3);
} }
/*
int main() int main()
{ {
DPMatrix3x3 m1, m2, check; DPMatrix3x3 m1, m2, check;
@ -170,3 +170,18 @@ int main()
return 0; return 0;
} }
*/
int main()
{
SPVector2 vector;
sp_vector2_set(0, 0, &vector);
printf("SPVector2(%f, %f), module = %d\n",
vector.x1,
vector.x2,
sp_vector2_is_zero(&vector)
);
return 0;
}

BIN
docs/documentation.odt Normal file

Binary file not shown.

View file

@ -58,10 +58,16 @@
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>
<Unit filename="matrix2x2.h" /> <Unit filename="matrix2x2.h" />
<Unit filename="matrix2x3.h" />
<Unit filename="matrix3x2.h" />
<Unit filename="matrix3x3.c"> <Unit filename="matrix3x3.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>
<Unit filename="matrix3x3.h" /> <Unit filename="matrix3x3.h" />
<Unit filename="matrixes.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrixes.h" />
<Unit filename="quaternion.c"> <Unit filename="quaternion.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>

View file

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

View file

@ -2,59 +2,19 @@
<CodeBlocks_layout_file> <CodeBlocks_layout_file>
<FileVersion major="1" minor="0" /> <FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" /> <ActiveTarget name="Debug" />
<File name="matrix3x3.c" open="1" top="1" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="quaternion.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="3207" topLine="198" /> <Cursor1 position="1849" topLine="67" />
</Cursor> </Cursor>
</File> </File>
<File name="angle.c" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="vector2.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="0" topLine="0" /> <Cursor1 position="2293" topLine="74" />
</Cursor> </Cursor>
</File> </File>
<File name="matrix3x3.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="basis.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="6363" topLine="266" /> <Cursor1 position="103" topLine="0" />
</Cursor>
</File>
<File name="vector2.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1940" topLine="25" />
</Cursor>
</File>
<File name="vector3.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="quaternion.c" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6789" topLine="145" />
</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="154" topLine="0" />
</Cursor>
</File>
<File name="matrix2x2.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="305" topLine="0" />
</Cursor>
</File>
<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="315" topLine="0" />
</Cursor>
</File>
<File name="quaternion.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3387" topLine="111" />
</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="305" topLine="29" />
</Cursor> </Cursor>
</File> </File>
<File name="angle.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="angle.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -62,34 +22,34 @@
<Cursor1 position="1082" topLine="0" /> <Cursor1 position="1082" topLine="0" />
</Cursor> </Cursor>
</File> </File>
<File name="vector2.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="matrix3x3.c" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="0" topLine="0" /> <Cursor1 position="23" topLine="72" />
</Cursor> </Cursor>
</File> </File>
<File name="basis.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="matrix3x2.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="103" topLine="8" /> <Cursor1 position="897" topLine="36" />
</Cursor>
</File>
<File name="matrix2x3.h" open="1" top="1" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1596" topLine="54" />
</Cursor> </Cursor>
</File> </File>
<File name="matrix2x2.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="matrix2x2.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="6700" topLine="238" /> <Cursor1 position="2885" topLine="183" />
</Cursor> </Cursor>
</File> </File>
<File name="versor.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="vector3.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="3718" topLine="116" /> <Cursor1 position="2779" topLine="79" />
</Cursor> </Cursor>
</File> </File>
<File name="basis.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="versor.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="20" topLine="0" /> <Cursor1 position="27" topLine="0" />
</Cursor>
</File>
<File name="vector3.c" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1436" topLine="15" />
</Cursor> </Cursor>
</File> </File>
<File name="versor.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="versor.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -97,4 +57,54 @@
<Cursor1 position="504" topLine="0" /> <Cursor1 position="504" topLine="0" />
</Cursor> </Cursor>
</File> </File>
<File name="quaternion.c" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6789" topLine="145" />
</Cursor>
</File>
<File name="vector3.c" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1436" topLine="15" />
</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="305" topLine="29" />
</Cursor>
</File>
<File name="matrix2x2.c" open="1" 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="matrix3x3.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3618" topLine="127" />
</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="154" topLine="0" />
</Cursor>
</File>
<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="vector2.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1940" topLine="25" />
</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="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>
</CodeBlocks_layout_file> </CodeBlocks_layout_file>

View file

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

View file

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

View file

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

View file

@ -1,24 +1 @@
#include "matrix2x2.h" #include "matrix2x2.h"
#include <math.h>
#include "angle.h"
const SPMatrix2x2 SP_ZERO_MATRIX2X2 = {
0.0f, 0.0f,
0.0f, 0.0f
};
const DPMatrix2x2 DP_ZERO_MATRIX2X2 = {
0.0, 0.0,
0.0, 0.0
};
const SPMatrix2x2 SP_IDENTITY_MATRIX2X2 = {
1.0f, 0.0f,
0.0f, 1.0f
};
const DPMatrix2x2 DP_IDENTITY_MATRIX2X2 = {
1.0, 0.0,
0.0, 1.0
};

View file

@ -3,24 +3,7 @@
#include "angle.h" #include "angle.h"
#include "vector2.h" #include "vector2.h"
#include "matrixes.h"
typedef struct {
float r1c1, r1c2;
float r2c1, r2c2;
} SPMatrix2x2;
typedef struct {
double r1c1, r1c2;
double r2c1, r2c2;
} DPMatrix2x2;
extern const SPMatrix2x2 SP_ZERO_MATRIX2X2;
extern const DPMatrix2x2 DP_ZERO_MATRIX2X2;
extern const SPMatrix2x2 SP_IDENTITY_MATRIX2X2;
extern const DPMatrix2x2 DP_IDENTITY_MATRIX2X2;
// =================== Reset ==================== // // =================== Reset ==================== //
@ -124,22 +107,24 @@ static inline void dp_matrix2x2_copy(const DPMatrix2x2* from, DPMatrix2x2* to)
// ============= Copy to twin type ============== // // ============= Copy to twin type ============== //
static inline void sp_matrix2x2_copy_to_double(const SPMatrix2x2* from, DPMatrix2x2* to) static inline void sp_matrix2x2_set_from_double(const DPMatrix2x2* from, SPMatrix2x2* to)
{
to->r1c1 = (double)from->r1c1;
to->r1c2 = (double)from->r1c2;
to->r2c1 = (double)from->r2c1;
to->r2c2 = (double)from->r2c2;
}
static inline void dp_matrix2x2_copy_to_single(const DPMatrix2x2* from, SPMatrix2x2* to)
{ {
to->r1c1 = (float)from->r1c1; to->r1c1 = (float)from->r1c1;
to->r1c2 = (float)from->r1c2; to->r1c2 = (float)from->r1c2;
to->r2c1 = (float)from->r2c1; to->r2c1 = (float)from->r2c1;
to->r2c2 = (float)from->r2c2; to->r2c2 = (float)from->r2c2;
} }
static inline void dp_matrix2x2_set_from_single(const SPMatrix2x2* from, DPMatrix2x2* to)
{
to->r1c1 = from->r1c1;
to->r1c2 = from->r1c2;
to->r2c1 = from->r2c1;
to->r2c2 = from->r2c2;
}
// ================ Determinant ================= // // ================ Determinant ================= //
static inline float sp_matrix2x2_get_determinant(const SPMatrix2x2* matrix) static inline float sp_matrix2x2_get_determinant(const SPMatrix2x2* matrix)
@ -232,98 +217,78 @@ static inline int dp_matrix2x2_invert(DPMatrix2x2* matrix)
return 1; return 1;
} }
// =============== Make Transposed ============== // // =============== Set Transposed =============== //
static inline void sp_matrix2x2_make_transposed(const SPMatrix2x2* matrix, SPMatrix2x2* result) static inline void sp_matrix2x2_set_transposed(const SPMatrix2x2* from, SPMatrix2x2* to)
{ {
if (matrix == result) { float tmp = from->r1c2;
sp_matrix2x2_transpose(result);
return;
}
result->r1c1 = matrix->r1c1; to->r1c1 = from->r1c1;
result->r1c2 = matrix->r2c1; to->r1c2 = from->r2c1;
result->r2c1 = matrix->r1c2; to->r2c1 = tmp;
result->r2c2 = matrix->r2c2; to->r2c2 = from->r2c2;
} }
static inline void dp_matrix2x2_make_transposed(const DPMatrix2x2* matrix, DPMatrix2x2* result) static inline void dp_matrix2x2_set_transposed(const DPMatrix2x2* from, DPMatrix2x2* to)
{ {
if (matrix == result) { double tmp = from->r1c2;
dp_matrix2x2_transpose(result);
return;
}
result->r1c1 = matrix->r1c1; to->r1c1 = from->r1c1;
result->r1c2 = matrix->r1c2; to->r1c2 = from->r2c1;
result->r2c1 = matrix->r2c1; to->r2c1 = tmp;
result->r2c2 = matrix->r2c2; to->r2c2 = from->r2c2;
} }
// ================ Make Inverted =============== // // ================ Set Inverted ================ //
static inline int sp_matrix2x2_make_inverted(const SPMatrix2x2* matrix, SPMatrix2x2* result) static inline int sp_matrix2x2_set_inverted(const SPMatrix2x2* from, SPMatrix2x2* to)
{ {
const float determinant = sp_matrix2x2_get_determinant(matrix); const float determinant = sp_matrix2x2_get_determinant(from);
if (-SP_EPSYLON <= determinant && determinant <= SP_EPSYLON) { if (-SP_EPSYLON <= determinant && determinant <= SP_EPSYLON) {
return 0; return 0;
} }
const float r1c1 = matrix->r2c2; const float r1c1 = from->r2c2;
const float r1c2 = -matrix->r1c2; const float r1c2 = -from->r1c2;
const float r2c1 = -matrix->r2c1; const float r2c1 = -from->r2c1;
const float r2c2 = matrix->r1c1; const float r2c2 = from->r1c1;
result->r1c1 = r1c1 / determinant; to->r1c1 = r1c1 / determinant;
result->r1c2 = r1c2 / determinant; to->r1c2 = r1c2 / determinant;
result->r2c1 = r2c1 / determinant; to->r2c1 = r2c1 / determinant;
result->r2c2 = r2c2 / determinant; to->r2c2 = r2c2 / determinant;
return 1; return 1;
} }
static inline int dp_matrix2x2_make_inverted(const DPMatrix2x2* matrix, DPMatrix2x2* result) static inline int dp_matrix2x2_set_inverted(const DPMatrix2x2* from, DPMatrix2x2* to)
{ {
const double determinant = dp_matrix2x2_get_determinant(matrix); const double determinant = dp_matrix2x2_get_determinant(from);
if (-DP_EPSYLON <= determinant && determinant <= DP_EPSYLON) { if (-DP_EPSYLON <= determinant && determinant <= DP_EPSYLON) {
return 0; return 0;
} }
const double r1c1 = matrix->r2c2; const double r1c1 = from->r2c2;
const double r1c2 = -matrix->r1c2; const double r1c2 = -from->r1c2;
const double r2c1 = -matrix->r2c1; const double r2c1 = -from->r2c1;
const double r2c2 = matrix->r1c1; const double r2c2 = from->r1c1;
result->r1c1 = r1c1 / determinant; to->r1c1 = r1c1 / determinant;
result->r1c2 = r1c2 / determinant; to->r1c2 = r1c2 / determinant;
result->r2c1 = r2c1 / determinant; to->r2c1 = r2c1 / determinant;
result->r2c2 = r2c2 / determinant; to->r2c2 = r2c2 / determinant;
return 1; return 1;
} }
// ================ Set Diagonal ================ //
static inline void sp_matrix2x2_set_main_diagonal(const float d1, const float d2, SPMatrix2x2* matrix)
{
matrix->r1c1 = d1;
matrix->r2c2 = d2;
}
static inline void dp_matrix2x2_set_main_diagonal(const double d1, const double d2, DPMatrix2x2* matrix)
{
matrix->r1c1 = d1;
matrix->r2c2 = d2;
}
// ================= Set Row 1 ================== // // ================= Set Row 1 ================== //
static inline void sp_matrix2x2_set_row1(const float c1, const float c2, SPMatrix2x2* matrix) static inline void sp_matrix2x2_set_row1(const float c1, const float c2, SPMatrix2x2* matrix)
@ -720,36 +685,4 @@ static inline void dp_matrix2x2_right_product(const DPMatrix2x2* matrix, const D
); );
} }
// =============== Matrix Product =============== //
static inline void sp_matrix2x2_matrix_product(const SPMatrix2x2* matrix1, const SPMatrix2x2* matrix2, SPMatrix2x2* result)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
}
static inline void dp_matrix2x2_matrix_product(const DPMatrix2x2* matrix1, const DPMatrix2x2* matrix2, DPMatrix2x2* result)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
}
#endif #endif

141
src/matrix2x3.h Normal file
View file

@ -0,0 +1,141 @@
#ifndef _GEOMETRY_MATRIX2X3_H_
#define _GEOMETRY_MATRIX2X3_H_
#include "vector2.h"
#include "vector3.h"
#include "matrixes.h"
// =================== Reset ==================== //
static inline void sp_matrix2x3_reset(SPMatrix2x3* 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 dp_matrix2x3_reset(DPMatrix2x3* 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 sp_matrix2x3_copy(const SPMatrix2x3* from, SPMatrix2x3* 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;
to->r3c1 = from->r3c1;
to->r3c2 = from->r3c2;
to->r3c3 = from->r3c3;
}
static inline void dp_matrix2x3_copy(const DPMatrix2x3* from, DPMatrix2x3* 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 sp_matrix2x3_set_from_double(const DPMatrix2x3* from, SPMatrix2x3* 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 dp_matrix2x3_set_from_single(const SPMatrix2x3* from, DPMatrix2x3* 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 sp_matrix2x3_set_transposed(const SPMatrix3x2* from, SPMatrix2x3* 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 dp_matrix2x3_set_transposed(const DPMatrix3x2* from, DPMatrix2x3* 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 sp_matrix2x3_transpose_double(const DPMatrix3x2* from, SPMatrix2x3* 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 dp_matrix2x3_transpose_single(const SPMatrix3x2* from, DPMatrix2x3* 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;
}
#endif

100
src/matrix3x2.h Normal file
View file

@ -0,0 +1,100 @@
#ifndef _GEOMETRY_MATRIX3X2_H_
#define _GEOMETRY_MATRIX3X2_H_
// =================== Reset ==================== //
static inline void sp_matrix3x2_reset(SPMatrix3x2* 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 dp_matrix3x2_reset(DPMatrix3x2* 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 sp_matrix3x2_set_from_double(const DPMatrix3x2* from, SPMatrix3x2* 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 dp_matrix3x2_set_from_single(const SPMatrix3x2* from, DPMatrix3x2* 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 sp_matrix3x2_set_transposed(const SPMatrix2x3* from, SPMatrix3x2* 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 dp_matrix3x2_set_transposed(const DPMatrix2x3* from, DPMatrix3x2* 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 sp_matrix3x2_transpose_double(const DPMatrix2x3* from, SPMatrix3x2* 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 dp_matrix3x2_transpose_single(const SPMatrix2x3* from, DPMatrix3x2* 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;
}
#endif

View file

@ -1,29 +1,5 @@
#include "matrix3x3.h" #include "matrix3x3.h"
const SPMatrix3x3 SP_ZERO_MATRIX3X3 = {
0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f
};
const DPMatrix3x3 DP_ZERO_MATRIX3X3 = {
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0
};
const SPMatrix3x3 SP_IDENTITY_MATRIX3X3 = {
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f
};
const DPMatrix3x3 DP_IDENTITY_MATRIX3X3 = {
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
};
// ================= Inversion ================== // // ================= Inversion ================== //
int sp_matrix3x3_invert(SPMatrix3x3* matrix) int sp_matrix3x3_invert(SPMatrix3x3* matrix)
@ -339,59 +315,3 @@ void dp_matrix3x3_get_weighted_sum5(
sum->r3c2 = (matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2) + (matrix3->r3c2 * weight3 + matrix4->r3c2 * weight4) + matrix5->r3c2 * weight5; sum->r3c2 = (matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2) + (matrix3->r3c2 * weight3 + matrix4->r3c2 * weight4) + matrix5->r3c2 * weight5;
sum->r3c3 = (matrix1->r3c3 * weight1 + matrix2->r3c3 * weight2) + (matrix3->r3c3 * weight3 + matrix4->r3c3 * weight4) + matrix5->r3c3 * weight5; sum->r3c3 = (matrix1->r3c3 * weight1 + matrix2->r3c3 * weight2) + (matrix3->r3c3 * weight3 + matrix4->r3c3 * weight4) + matrix5->r3c3 * weight5;
} }
// =============== Matrix Product =============== //
void sp_matrix3x3_matrix_product(const SPMatrix3x3* matrix1, const SPMatrix3x3* matrix2, SPMatrix3x3* result)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
const float r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
const float r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
const float r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3 + matrix1->r3c3 * matrix2->r3c3;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r1c3 = r1c3;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r2c3 = r2c3;
result->r3c1 = r3c1;
result->r3c2 = r3c2;
result->r3c3 = r3c3;
}
void dp_matrix3x3_matrix_product(const DPMatrix3x3* matrix1, const DPMatrix3x3* matrix2, DPMatrix3x3* result)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const double r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const double r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
const double r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3 + matrix1->r3c3 * matrix2->r3c3;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r1c3 = r1c3;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r2c3 = r2c3;
result->r3c1 = r3c1;
result->r3c2 = r3c2;
result->r3c3 = r3c3;
}

View file

@ -2,26 +2,7 @@
#define _GEOMETRY_MATRIX3X3_H_ #define _GEOMETRY_MATRIX3X3_H_
#include "vector3.h" #include "vector3.h"
#include "matrixes.h"
typedef struct {
float r1c1, r1c2, r1c3;
float r2c1, r2c2, r2c3;
float r3c1, r3c2, r3c3;
} SPMatrix3x3;
typedef struct {
double r1c1, r1c2, r1c3;
double r2c1, r2c2, r2c3;
double r3c1, r3c2, r3c3;
} DPMatrix3x3;
extern const SPMatrix3x3 SP_ZERO_MATRIX3X3;
extern const DPMatrix3x3 DP_ZERO_MATRIX3X3;
extern const SPMatrix3x3 SP_IDENTITY_MATRIX3X3;
extern const DPMatrix3x3 DP_IDENTITY_MATRIX3X3;
// =================== Reset ==================== // // =================== Reset ==================== //
@ -151,24 +132,9 @@ static inline void dp_matrix3x3_copy(const DPMatrix3x3* from, DPMatrix3x3* to)
to->r3c3 = from->r3c3; to->r3c3 = from->r3c3;
} }
// ============= Copy to twin type ============== // // ============= Set from twin type ============= //
static inline void sp_matrix3x3_copy_to_double(const SPMatrix3x3* from, DPMatrix3x3* to) static inline void sp_matrix3x3_set_from_double(const DPMatrix3x3* from, SPMatrix3x3* to)
{
to->r1c1 = (double)from->r1c1;
to->r1c2 = (double)from->r1c2;
to->r1c3 = (double)from->r1c3;
to->r2c1 = (double)from->r2c1;
to->r2c2 = (double)from->r2c2;
to->r2c3 = (double)from->r2c3;
to->r3c1 = (double)from->r3c1;
to->r3c2 = (double)from->r3c2;
to->r3c3 = (double)from->r3c3;
}
static inline void dp_matrix3x3_copy_to_single(const DPMatrix3x3* from, SPMatrix3x3* to)
{ {
to->r1c1 = (float)from->r1c1; to->r1c1 = (float)from->r1c1;
to->r1c2 = (float)from->r1c2; to->r1c2 = (float)from->r1c2;
@ -183,6 +149,21 @@ static inline void dp_matrix3x3_copy_to_single(const DPMatrix3x3* from, SPMatrix
to->r3c3 = (float)from->r3c3; to->r3c3 = (float)from->r3c3;
} }
static inline void dp_matrix3x3_set_from_single(const SPMatrix3x3* from, DPMatrix3x3* 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;
to->r3c1 = from->r3c1;
to->r3c2 = from->r3c2;
to->r3c3 = from->r3c3;
}
// ================ Determinant ================= // // ================ Determinant ================= //
static inline float sp_matrix3x3_get_determinant(const SPMatrix3x3* matrix) static inline float sp_matrix3x3_get_determinant(const SPMatrix3x3* matrix)
@ -785,10 +766,4 @@ static inline void dp_matrix3x3_right_product(const DPMatrix3x3* matrix, const D
); );
} }
// =============== Matrix Product =============== //
void sp_matrix3x3_matrix_product(const SPMatrix3x3* matrix1, const SPMatrix3x3* matrix2, SPMatrix3x3* result);
void dp_matrix3x3_matrix_product(const DPMatrix3x3* matrix1, const DPMatrix3x3* matrix2, DPMatrix3x3* result);
#endif #endif

257
src/matrixes.c Normal file
View file

@ -0,0 +1,257 @@
#include "matrixes.h"
// ========== Matrix Product 2x2 at 3x2 ========= //
void sp_matrix_product_2x2_at_3x2(const SPMatrix2x2* matrix1, const SPMatrix3x2* matrix2, SPMatrix3x2* result)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r1c3 = r1c3;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r2c3 = r2c3;
}
void dp_matrix_product_2x2_at_3x2(const DPMatrix2x2* matrix1, const DPMatrix3x2* matrix2, DPMatrix3x2* result)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const double r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
const double r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r1c3 = r1c3;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r2c3 = r2c3;
}
// ========== Matrix Product 2x3 at 2x2 ========= //
void sp_matrix_product_2x3_at_2x2(const SPMatrix2x3* matrix1, const SPMatrix2x2* matrix2, SPMatrix2x3* result)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
const float r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
const float r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r3c1 = r3c1;
result->r3c2 = r3c2;
}
void dp_matrix_product_2x3_at_2x2(const DPMatrix2x3* matrix1, const DPMatrix2x2* matrix2, DPMatrix2x3* result)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r3c1 = r3c1;
result->r3c2 = r3c2;
}
// ========== Matrix Product 2x3 at 3x2 ========= //
void sp_matrix_product_2x3_at_3x2(const SPMatrix2x3* matrix1, const SPMatrix3x2* matrix2, SPMatrix3x3* result)
{
result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
result->r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
result->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
result->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
result->r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
result->r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
result->r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
result->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3;
}
void dp_matrix_product_2x3_at_3x2(const DPMatrix2x3* matrix1, const DPMatrix3x2* matrix2, DPMatrix3x3* result)
{
result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
result->r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
result->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
result->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
result->r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
result->r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
result->r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
result->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3;
}
// ========== Matrix Product 3x2 at 3x3 ========= //
void sp_matrix_product_3x2_at_3x3(const SPMatrix3x2* matrix1, const SPMatrix3x3* matrix2, SPMatrix3x2* result)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r1c3 = r1c3;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r2c3 = r2c3;
}
void dp_matrix_product_3x2_at_3x3(const DPMatrix3x2* matrix1, const DPMatrix3x3* matrix2, DPMatrix3x2* result)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r1c3 = r1c3;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r2c3 = r2c3;
}
// ========== Matrix Product 3x3 at 2x3 ========= //
void sp_matrix_product_3x3_at_2x3(const SPMatrix3x3* matrix1, const SPMatrix2x3* matrix2, SPMatrix2x3* result)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r3c1 = r3c1;
result->r3c2 = r3c2;
}
void dp_matrix_product_3x3_at_2x3(const DPMatrix3x3* matrix1, const DPMatrix2x3* matrix2, DPMatrix2x3* result)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r3c1 = r3c1;
result->r3c2 = r3c2;
}
// ========== Matrix Product 3x3 at 3x3 ========= //
void sp_matrix_product_3x3_at_3x3(const SPMatrix3x3* matrix1, const SPMatrix3x3* matrix2, SPMatrix3x3* result)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
const float r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
const float r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
const float r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3 + matrix1->r3c3 * matrix2->r3c3;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r1c3 = r1c3;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r2c3 = r2c3;
result->r3c1 = r3c1;
result->r3c2 = r3c2;
result->r3c3 = r3c3;
}
void dp_matrix_product_3x3_at_3x3(const DPMatrix3x3* matrix1, const DPMatrix3x3* matrix2, DPMatrix3x3* result)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const double r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const double r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
const double r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3 + matrix1->r3c3 * matrix2->r3c3;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r1c3 = r1c3;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
result->r2c3 = r2c3;
result->r3c1 = r3c1;
result->r3c2 = r3c2;
result->r3c3 = r3c3;
}

144
src/matrixes.h Normal file
View file

@ -0,0 +1,144 @@
#ifndef _GEOMETRY_MATRIX_TYPES_H_
#define _GEOMETRY_MATRIX_TYPES_H_
// ================== Matrix2x2 ================= //
typedef struct {
float r1c1, r1c2;
float r2c1, r2c2;
} SPMatrix2x2;
typedef struct {
double r1c1, r1c2;
double r2c1, r2c2;
} DPMatrix2x2;
// ================== Matrix2x3 ================= //
typedef struct {
float r1c1, r1c2;
float r2c1, r2c2;
float r3c1, r3c2;
} SPMatrix2x3;
typedef struct {
double r1c1, r1c2;
double r2c1, r2c2;
double r3c1, r3c2;
} DPMatrix2x3;
// ================== Matrix3x2 ================= //
typedef struct {
float r1c1, r1c2, r1c3;
float r2c1, r2c2, r2c3;
} SPMatrix3x2;
typedef struct {
double r1c1, r1c2, r1c3;
double r2c1, r2c2, r2c3;
} DPMatrix3x2;
// ================== Matrix3x3 ================= //
typedef struct {
float r1c1, r1c2, r1c3;
float r2c1, r2c2, r2c3;
float r3c1, r3c2, r3c3;
} SPMatrix3x3;
typedef struct {
double r1c1, r1c2, r1c3;
double r2c1, r2c2, r2c3;
double r3c1, r3c2, r3c3;
} DPMatrix3x3;
// ========== Matrix Product 2x2 at 2x2 ========= //
static inline void sp_matrix_product_2x2_at_2x2(const SPMatrix2x2* matrix1, const SPMatrix2x2* matrix2, SPMatrix2x2* result)
{
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
}
static inline void dp_matrix_product_2x2_at_2x2(const DPMatrix2x2* matrix1, const DPMatrix2x2* matrix2, DPMatrix2x2* result)
{
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
result->r1c1 = r1c1;
result->r1c2 = r1c2;
result->r2c1 = r2c1;
result->r2c2 = r2c2;
}
// ========== Matrix Product 2x2 at 3x2 ========= //
void sp_matrix_product_2x2_at_3x2(const SPMatrix2x2* matrix1, const SPMatrix3x2* matrix2, SPMatrix3x2* result);
void dp_matrix_product_2x2_at_3x2(const DPMatrix2x2* matrix1, const DPMatrix3x2* matrix2, DPMatrix3x2* result);
// ========== Matrix Product 2x3 at 2x2 ========= //
void sp_matrix_product_2x3_at_2x2(const SPMatrix2x3* matrix1, const SPMatrix2x2* matrix2, SPMatrix2x3* result);
void dp_matrix_product_2x3_at_2x2(const DPMatrix2x3* matrix1, const DPMatrix2x2* matrix2, DPMatrix2x3* result);
// ========== Matrix Product 2x3 at 3x2 ========= //
void sp_matrix_product_2x3_at_3x2(const SPMatrix2x3* matrix1, const SPMatrix3x2* matrix2, SPMatrix3x3* result);
void dp_matrix_product_2x3_at_3x2(const DPMatrix2x3* matrix1, const DPMatrix3x2* matrix2, DPMatrix3x3* result);
// ========== Matrix Product 3x2 at 2x3 ========= //
void sp_matrix_product_3x2_at_2x3(const SPMatrix3x2* matrix1, const SPMatrix2x3* matrix2, SPMatrix2x2* result)
{
result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
result->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
result->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
}
void dp_matrix_product_3x2_at_2x3(const DPMatrix3x2* matrix1, const DPMatrix2x3* matrix2, DPMatrix2x2* result)
{
result->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
result->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
result->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
result->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
}
// ========== Matrix Product 3x2 at 3x3 ========= //
void sp_matrix_product_3x2_at_3x3(const SPMatrix3x2* matrix1, const SPMatrix3x3* matrix2, SPMatrix3x2* result);
void dp_matrix_product_3x2_at_3x3(const DPMatrix3x2* matrix1, const DPMatrix3x3* matrix2, DPMatrix3x2* result);
// ========== Matrix Product 3x3 at 2x3 ========= //
void sp_matrix_product_3x3_at_2x3(const SPMatrix3x3* matrix1, const SPMatrix2x3* matrix2, SPMatrix2x3* result);
void dp_matrix_product_3x3_at_2x3(const DPMatrix3x3* matrix1, const DPMatrix2x3* matrix2, DPMatrix2x3* result);
// ========== Matrix Product 3x3 at 3x3 ========= //
void sp_matrix_product_3x3_at_3x3(const SPMatrix3x3* matrix1, const SPMatrix3x3* matrix2, SPMatrix3x3* result);
void dp_matrix_product_3x3_at_3x3(const DPMatrix3x3* matrix1, const DPMatrix3x3* matrix2, DPMatrix3x3* result);
#endif // _GEOMETRY_MATRIX_TYPES_H_

View file

@ -32,9 +32,27 @@ static inline void dp_quaternion_reset(DPQuaternion * quaternion)
quaternion->x3 = 0.0; quaternion->x3 = 0.0;
} }
// ================== Set Unit ================== //
static inline void sp_quaternion_set_identity(SPQuaternion * quaternion)
{
quaternion->s0 = 1.0f;
quaternion->x1 = 0.0f;
quaternion->x2 = 0.0f;
quaternion->x3 = 0.0f;
}
static inline void dp_quaternion_set_identity(DPQuaternion * quaternion)
{
quaternion->s0 = 1.0;
quaternion->x1 = 0.0;
quaternion->x2 = 0.0;
quaternion->x3 = 0.0;
}
// ==================== Set ===================== // // ==================== Set ===================== //
static inline void sp_quaternion_set(const float s0, const float x1, const float x2, const float x3, SPQuaternion * quaternion) static inline void sp_quaternion_set_values(const float s0, const float x1, const float x2, const float x3, SPQuaternion * quaternion)
{ {
quaternion->s0 = s0; quaternion->s0 = s0;
quaternion->x1 = x1; quaternion->x1 = x1;
@ -42,7 +60,7 @@ static inline void sp_quaternion_set(const float s0, const float x1, const float
quaternion->x3 = x3; quaternion->x3 = x3;
} }
static inline void dp_quaternion_set(const double s0, const double x1, const double x2, const double x3, DPQuaternion * quaternion) static inline void dp_quaternion_set_values(const double s0, const double x1, const double x2, const double x3, DPQuaternion * quaternion)
{ {
quaternion->s0 = s0; quaternion->s0 = s0;
quaternion->x1 = x1; quaternion->x1 = x1;
@ -70,15 +88,7 @@ static inline void dp_quaternion_copy(const DPQuaternion* from, DPQuaternion* to
// ============= Copy to twin type ============== // // ============= Copy to twin type ============== //
static inline void sp_quaternion_copy_to_double(const SPQuaternion* versor, DPQuaternion* result) static inline void sp_quaternion_copy_from_double(const DPQuaternion* versor, SPQuaternion* result)
{
result->s0 = (double)versor->s0;
result->x1 = (double)versor->x1;
result->x2 = (double)versor->x2;
result->x3 = (double)versor->x3;
}
static inline void dp_quaternion_copy_to_single(const DPQuaternion* versor, SPQuaternion* result)
{ {
result->s0 = (float)versor->s0; result->s0 = (float)versor->s0;
result->x1 = (float)versor->x1; result->x1 = (float)versor->x1;
@ -86,6 +96,14 @@ static inline void dp_quaternion_copy_to_single(const DPQuaternion* versor, SPQu
result->x3 = (float)versor->x3; result->x3 = (float)versor->x3;
} }
static inline void dp_quaternion_copy_from_single(const SPQuaternion* versor, DPQuaternion* result)
{
result->s0 = versor->s0;
result->x1 = versor->x1;
result->x2 = versor->x2;
result->x3 = versor->x3;
}
// ================= Inversion ================== // // ================= Inversion ================== //
static inline void sp_quaternion_conjugate(SPQuaternion* versor) static inline void sp_quaternion_conjugate(SPQuaternion* versor)
@ -102,9 +120,9 @@ static inline void dp_quaternion_conjugate(DPQuaternion* versor)
versor->x3 = -versor->x3; versor->x3 = -versor->x3;
} }
// ================ Get Inverted ================ // // ================ Set Conjugate =============== //
static inline void sp_quaternion_get_conjugate(const SPQuaternion* versor, SPQuaternion* result) static inline void sp_quaternion_set_conjugate(const SPQuaternion* versor, SPQuaternion* result)
{ {
result->s0 = versor->s0; result->s0 = versor->s0;
result->x1 = -versor->x1; result->x1 = -versor->x1;
@ -112,7 +130,25 @@ static inline void sp_quaternion_get_conjugate(const SPQuaternion* versor, SPQua
result->x3 = -versor->x3; result->x3 = -versor->x3;
} }
static inline void dp_quaternion_get_conjugate(const DPQuaternion* versor, DPQuaternion* result) static inline void dp_quaternion_set_conjugate(const DPQuaternion* versor, DPQuaternion* result)
{
result->s0 = versor->s0;
result->x1 = -versor->x1;
result->x2 = -versor->x2;
result->x3 = -versor->x3;
}
// ================ Get Inverted ================ //
static inline void sp_quaternion_conjugate_double(const DPQuaternion* versor, SPQuaternion* result)
{
result->s0 = (float)versor->s0;
result->x1 = -(float)versor->x1;
result->x2 = -(float)versor->x2;
result->x3 = -(float)versor->x3;
}
static inline void dp_quaternion_conjugate_single(const SPQuaternion* versor, DPQuaternion* result)
{ {
result->s0 = versor->s0; result->s0 = versor->s0;
result->x1 = -versor->x1; result->x1 = -versor->x1;

View file

@ -1,73 +1,73 @@
#include "vector2.h" #include "vector2.h"
const SPVector2 SP_ZERO_VECTOR2 = { 0.0f, 0.0f }; const SPVector2 SP_ZERO_VECTOR2 = { 0.0f, 0.0f };
const SPVector2 SP_X1_UNIT_VECTOR2 = { 1.0f, 0.0f }; const SPVector2 SP_X1_UNIT_VECTOR2 = { 1.0f, 0.0f };
const SPVector2 SP_X2_UNIT_VECTOR2 = { 0.0f, 1.0f }; const SPVector2 SP_X2_UNIT_VECTOR2 = { 0.0f, 1.0f };
const DPVector2 DP_ZERO_VECTOR2 = { 0.0, 0.0 }; const DPVector2 DP_ZERO_VECTOR2 = { 0.0, 0.0 };
const DPVector2 DP_X1_UNIT_VECTOR2 = { 1.0, 0.0 }; const DPVector2 DP_X1_UNIT_VECTOR2 = { 1.0, 0.0 };
const DPVector2 DP_X2_UNIT_VECTOR2 = { 0.0, 1.0 }; const DPVector2 DP_X2_UNIT_VECTOR2 = { 0.0, 1.0 };
// =================== Angle ==================== // // =================== Angle ==================== //
float sp_vector2_angle(const SPVector2* vector1, const SPVector2* vector2, const angle_unit_t unit) float sp_vector2_angle(const SPVector2* vector1, const SPVector2* vector2, const angle_unit_t unit)
{ {
if (vector1 == 0 || vector2 == 0) { if (vector1 == 0 || vector2 == 0) {
return 0.0f; return 0.0f;
} }
const float square_module1 = sp_vector2_get_square_module(vector1); const float square_module1 = sp_vector2_get_square_module(vector1);
if (square_module1 <= SP_SQUARE_EPSYLON) { if (square_module1 <= SP_SQUARE_EPSYLON) {
return 0.0f; return 0.0f;
} }
const float square_module2 = sp_vector2_get_square_module(vector2); const float square_module2 = sp_vector2_get_square_module(vector2);
if (square_module2 <= SP_SQUARE_EPSYLON) { if (square_module2 <= SP_SQUARE_EPSYLON) {
return 0.0f; return 0.0f;
} }
const float cosine = sp_vector2_scalar(vector1, vector2) / sqrtf(square_module1 * square_module2); const float cosine = sp_vector2_scalar(vector1, vector2) / sqrtf(square_module1 * square_module2);
if (cosine >= 1.0f - SP_EPSYLON) { if (cosine >= 1.0f - SP_EPSYLON) {
return 0.0f; return 0.0f;
} }
if (cosine <= -1.0f + SP_EPSYLON) { if (cosine <= -1.0f + SP_EPSYLON) {
return sp_get_half_circle(unit); return sp_get_half_circle(unit);
} }
return sp_convert_from_radians(acosf(cosine), unit); return sp_convert_from_radians(acosf(cosine), unit);
} }
double dp_vector2_angle(const DPVector2* vector1, const DPVector2* vector2, const angle_unit_t unit) double dp_vector2_angle(const DPVector2* vector1, const DPVector2* vector2, const angle_unit_t unit)
{ {
if (vector1 == 0 || vector2 == 0) { if (vector1 == 0 || vector2 == 0) {
return 0.0; return 0.0;
} }
const double square_module1 = dp_vector2_get_square_module(vector1); const double square_module1 = dp_vector2_get_square_module(vector1);
if (square_module1 <= DP_SQUARE_EPSYLON) { if (square_module1 <= DP_SQUARE_EPSYLON) {
return 0.0; return 0.0;
} }
const double square_module2 = dp_vector2_get_square_module(vector2); const double square_module2 = dp_vector2_get_square_module(vector2);
if (square_module2 <= DP_SQUARE_EPSYLON) { if (square_module2 <= DP_SQUARE_EPSYLON) {
return 0.0; return 0.0;
} }
const double cosine = dp_vector2_scalar(vector1, vector2) / sqrt(square_module1 * square_module2); const double cosine = dp_vector2_scalar(vector1, vector2) / sqrt(square_module1 * square_module2);
if (cosine >= 1.0 - DP_EPSYLON) { if (cosine >= 1.0 - DP_EPSYLON) {
return 0.0; return 0.0;
} }
if (cosine <= -1.0 + DP_EPSYLON) { if (cosine <= -1.0 + DP_EPSYLON) {
return dp_get_half_circle(unit); return dp_get_half_circle(unit);
} }
return dp_convert_from_radians(acos(cosine), unit); return dp_convert_from_radians(acos(cosine), unit);
} }

View file

@ -38,6 +38,20 @@ static inline void dp_vector2_reset(DPVector2* vector)
vector->x2 = 0.0; vector->x2 = 0.0;
} }
// ==================== Set ===================== //
static inline void sp_vector2_set_values(const float x1, const float x2, SPVector2* to)
{
to->x1 = x1;
to->x2 = x2;
}
static inline void dp_vector2_set_values(const double x1, const double x2, DPVector2* to)
{
to->x1 = x1;
to->x2 = x2;
}
// ==================== Copy ==================== // // ==================== Copy ==================== //
static inline void sp_vector2_copy(const SPVector2* from, SPVector2* to) static inline void sp_vector2_copy(const SPVector2* from, SPVector2* to)
@ -52,18 +66,46 @@ static inline void dp_vector2_copy(const DPVector2* from, DPVector2* to)
to->x2 = from->x2; to->x2 = from->x2;
} }
// ==================== Set ===================== // // ============= Copy to twin type ============== //
static inline void sp_vector2_set(const float x1, const float x2, SPVector2* to) static inline void sp_vector2_copy_from_double(const DPVector2* from, SPVector2* to)
{ {
to->x1 = x1; to->x1 = (float)from->x1;
to->x2 = x2; to->x2 = (float)from->x2;
} }
static inline void dp_vector2_set(const double x1, const double x2, DPVector2* to) static inline void dp_vector2_copy_from_single(const SPVector2* from, DPVector2* to)
{ {
to->x1 = x1; to->x1 = from->x1;
to->x2 = x2; to->x2 = from->x2;
}
// =================== Reverse ================== //
static inline void sp_vector2_reverse(const SPVector2* from, SPVector2* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
}
static inline void dp_vector2_reverse(const DPVector2* from, DPVector2* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
}
// ============= Reverse twin type ============== //
static inline void sp_vector2_reverse_double(const DPVector2* from, SPVector2* to)
{
to->x1 = -(float)from->x1;
to->x2 = -(float)from->x2;
}
static inline void dp_vector2_reverse_single(const SPVector2* from, DPVector2* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
} }
// =================== Module =================== // // =================== Module =================== //
@ -114,48 +156,6 @@ static inline int dp_vector2_is_unit(const DPVector2* vector)
return 1.0f - DP_TWO_EPSYLON <= square_module && square_module <= 1.0f + DP_TWO_EPSYLON; return 1.0f - DP_TWO_EPSYLON <= square_module && square_module <= 1.0f + DP_TWO_EPSYLON;
} }
// ============= Copy to twin type ============== //
static inline void sp_vector2_copy_to_double(const SPVector2* from, DPVector2* to)
{
to->x1 = (double)from->x1;
to->x2 = (double)from->x2;
}
static inline void dp_vector2_copy_to_single(const DPVector2* from, SPVector2* to)
{
to->x1 = (float)from->x1;
to->x2 = (float)from->x2;
}
// ================= Inversion ================== //
static inline void sp_vector2_invert(SPVector2* vector)
{
vector->x1 = -vector->x1;
vector->x2 = -vector->x2;
}
static inline void dp_vector2_invert(DPVector2* vector)
{
vector->x1 = -vector->x1;
vector->x2 = -vector->x2;
}
// ================ Get Inverted ================ //
static inline void sp_vector2_get_inverted(const SPVector2* vector, SPVector2* result)
{
result->x1 = -vector->x1;
result->x2 = -vector->x2;
}
static inline void dp_vector2_get_inverted(const DPVector2* vector, DPVector2* result)
{
result->x1 = -vector->x1;
result->x2 = -vector->x2;
}
// ==================== Add ===================== // // ==================== Add ===================== //
static inline void sp_vector2_add(const SPVector2* vector1, const SPVector2* vector2, SPVector2* result) static inline void sp_vector2_add(const SPVector2* vector1, const SPVector2* vector2, SPVector2* result)

View file

@ -1,75 +1,75 @@
#include "vector3.h" #include "vector3.h"
const SPVector3 SP_ZERO_VECTOR3 = { 0.0f, 0.0f, 0.0f }; const SPVector3 SP_ZERO_VECTOR3 = { 0.0f, 0.0f, 0.0f };
const SPVector3 SP_X1_UNIT_VECTOR3 = { 1.0f, 0.0f, 0.0f }; const SPVector3 SP_X1_UNIT_VECTOR3 = { 1.0f, 0.0f, 0.0f };
const SPVector3 SP_X2_UNIT_VECTOR3 = { 0.0f, 1.0f, 0.0f }; const SPVector3 SP_X2_UNIT_VECTOR3 = { 0.0f, 1.0f, 0.0f };
const SPVector3 SP_X3_UNIT_VECTOR3 = { 0.0f, 0.0f, 1.0f }; const SPVector3 SP_X3_UNIT_VECTOR3 = { 0.0f, 0.0f, 1.0f };
const DPVector3 DP_ZERO_VECTOR3 = { 0.0, 0.0, 0.0 }; const DPVector3 DP_ZERO_VECTOR3 = { 0.0, 0.0, 0.0 };
const DPVector3 DP_X1_UNIT_VECTOR3 = { 1.0, 0.0, 0.0 }; const DPVector3 DP_X1_UNIT_VECTOR3 = { 1.0, 0.0, 0.0 };
const DPVector3 DP_X2_UNIT_VECTOR3 = { 0.0, 1.0, 0.0 }; const DPVector3 DP_X2_UNIT_VECTOR3 = { 0.0, 1.0, 0.0 };
const DPVector3 DP_X3_UNIT_VECTOR3 = { 0.0, 0.0, 1.0 }; const DPVector3 DP_X3_UNIT_VECTOR3 = { 0.0, 0.0, 1.0 };
// =================== Angle ==================== // // =================== Angle ==================== //
float sp_vector3_angle(const SPVector3* vector1, const SPVector3* vector2, const angle_unit_t unit) float sp_vector3_angle(const SPVector3* vector1, const SPVector3* vector2, const angle_unit_t unit)
{ {
if (vector1 == 0 || vector2 == 0) { if (vector1 == 0 || vector2 == 0) {
return 0.0f; return 0.0f;
} }
const float square_module1 = sp_vector3_get_square_module(vector1); const float square_module1 = sp_vector3_get_square_module(vector1);
if (square_module1 <= SP_SQUARE_EPSYLON) { if (square_module1 <= SP_SQUARE_EPSYLON) {
return 0.0f; return 0.0f;
} }
const float square_module2 = sp_vector3_get_square_module(vector2); const float square_module2 = sp_vector3_get_square_module(vector2);
if (square_module2 <= SP_SQUARE_EPSYLON) { if (square_module2 <= SP_SQUARE_EPSYLON) {
return 0.0f; return 0.0f;
} }
const float cosine = sp_vector3_scalar(vector1, vector2) / sqrtf(square_module1 * square_module2); const float cosine = sp_vector3_scalar(vector1, vector2) / sqrtf(square_module1 * square_module2);
if (cosine >= 1.0f - SP_EPSYLON) { if (cosine >= 1.0f - SP_EPSYLON) {
return 0.0f; return 0.0f;
} }
if (cosine <= -1.0f + SP_EPSYLON) { if (cosine <= -1.0f + SP_EPSYLON) {
return sp_get_half_circle(unit); return sp_get_half_circle(unit);
} }
return sp_convert_from_radians(acosf(cosine), unit); return sp_convert_from_radians(acosf(cosine), unit);
} }
double dp_vector3_angle(const DPVector3* vector1, const DPVector3* vector2, const angle_unit_t unit) double dp_vector3_angle(const DPVector3* vector1, const DPVector3* vector2, const angle_unit_t unit)
{ {
if (vector1 == 0 || vector2 == 0) { if (vector1 == 0 || vector2 == 0) {
return 0.0; return 0.0;
} }
const double square_module1 = dp_vector3_get_square_module(vector1); const double square_module1 = dp_vector3_get_square_module(vector1);
if (square_module1 <= DP_SQUARE_EPSYLON) { if (square_module1 <= DP_SQUARE_EPSYLON) {
return 0.0; return 0.0;
} }
const double square_module2 = dp_vector3_get_square_module(vector2); const double square_module2 = dp_vector3_get_square_module(vector2);
if (square_module2 <= DP_SQUARE_EPSYLON) { if (square_module2 <= DP_SQUARE_EPSYLON) {
return 0.0; return 0.0;
} }
const double cosine = dp_vector3_scalar(vector1, vector2) / sqrt(square_module1 * square_module2); const double cosine = dp_vector3_scalar(vector1, vector2) / sqrt(square_module1 * square_module2);
if (cosine >= 1.0 - DP_EPSYLON) { if (cosine >= 1.0 - DP_EPSYLON) {
return 0.0; return 0.0;
} }
if (cosine <= -1.0 + DP_EPSYLON) { if (cosine <= -1.0 + DP_EPSYLON) {
return dp_get_half_circle(unit); return dp_get_half_circle(unit);
} }
return dp_convert_from_radians(acos(cosine), unit); return dp_convert_from_radians(acos(cosine), unit);
} }

View file

@ -44,6 +44,22 @@ static inline void dp_vector3_reset(DPVector3* vector)
vector->x3 = 0.0; vector->x3 = 0.0;
} }
// ==================== Set ===================== //
static inline void sp_vector3_set_values(const float x1, const float x2, const float x3, SPVector3* to)
{
to->x1 = x1;
to->x2 = x2;
to->x3 = x3;
}
static inline void dp_vector3_set_values(const double x1, const double x2, const double x3, DPVector3* to)
{
to->x1 = x1;
to->x2 = x2;
to->x3 = x3;
}
// ==================== Copy ==================== // // ==================== Copy ==================== //
static inline void sp_vector3_copy(const SPVector3* from, SPVector3* to) static inline void sp_vector3_copy(const SPVector3* from, SPVector3* to)
@ -60,20 +76,52 @@ static inline void dp_vector3_copy(const DPVector3* from, DPVector3* to)
to->x3 = from->x3; to->x3 = from->x3;
} }
// ==================== Set ===================== // // ============= Copy to twin type ============== //
static inline void sp_vector3_set(const float x1, const float x2, const float x3, SPVector3* to) static inline void sp_vector3_copy_from_double(const DPVector3* from, SPVector3* to)
{ {
to->x1 = x1; to->x1 = (float)from->x1;
to->x2 = x2; to->x2 = (float)from->x2;
to->x3 = x3; to->x3 = (float)from->x3;
} }
static inline void dp_vector3_set(const double x1, const double x2, const double x3, DPVector3* to) static inline void dp_vector3_copy_from_single(const SPVector3* from, DPVector3* to)
{ {
to->x1 = x1; to->x1 = from->x1;
to->x2 = x2; to->x2 = from->x2;
to->x3 = x3; to->x3 = from->x3;
}
// =================== Reverse ================== //
static inline void sp_vector3_reverse(const SPVector3* from, SPVector3* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
to->x3 = -from->x3;
}
static inline void dp_vector3_reverse(const DPVector3* from, DPVector3* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
to->x3 = -from->x3;
}
// ============= Reverse twin type ============== //
static inline void sp_vector3_reverse_double(const DPVector3* from, SPVector3* to)
{
to->x1 = -(float)from->x1;
to->x2 = -(float)from->x2;
to->x3 = -(float)from->x3;
}
static inline void dp_vector3_reverse_single(const SPVector3* from, DPVector3* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
to->x3 = -from->x3;
} }
// =================== Module =================== // // =================== Module =================== //
@ -124,54 +172,6 @@ static inline int dp_vector3_is_unit(const DPVector3* vector)
return 1.0f - DP_TWO_EPSYLON <= square_module && square_module <= 1.0f + DP_TWO_EPSYLON; return 1.0f - DP_TWO_EPSYLON <= square_module && square_module <= 1.0f + DP_TWO_EPSYLON;
} }
// ============= Copy to twin type ============== //
static inline void sp_vector3_copy_to_double(const SPVector3* from, DPVector3* to)
{
to->x1 = (double)from->x1;
to->x2 = (double)from->x2;
to->x3 = (double)from->x3;
}
static inline void dp_vector3_copy_to_single(const DPVector3* from, SPVector3* to)
{
to->x1 = (float)from->x1;
to->x2 = (float)from->x2;
to->x3 = (float)from->x3;
}
// ================= Inversion ================== //
static inline void sp_vector3_invert(SPVector3* vector)
{
vector->x1 = -vector->x1;
vector->x2 = -vector->x2;
vector->x3 = -vector->x3;
}
static inline void dp_vector3_invert(DPVector3* vector)
{
vector->x1 = -vector->x1;
vector->x2 = -vector->x2;
vector->x3 = -vector->x3;
}
// ================ Get Inverted ================ //
static inline void sp_vector3_get_inverted(const SPVector3* vector, SPVector3* result)
{
result->x1 = -vector->x1;
result->x2 = -vector->x2;
result->x3 = -vector->x3;
}
static inline void dp_vector3_get_inverted(const DPVector3* vector, DPVector3* result)
{
result->x1 = -vector->x1;
result->x2 = -vector->x2;
result->x3 = -vector->x3;
}
// ==================== Add ===================== // // ==================== Add ===================== //
static inline void sp_vector3_add(const SPVector3* vector1, const SPVector3* vector2, SPVector3* result) static inline void sp_vector3_add(const SPVector3* vector1, const SPVector3* vector2, SPVector3* result)

View file

@ -226,18 +226,7 @@ static inline int dp_versor_is_idle(const DPVersor* versor)
// ============= Copy to twin type ============== // // ============= Copy to twin type ============== //
static inline void sp_versor_copy_to_double(const SPVersor* versor, DPVersor* result) static inline void sp_versor_from_double(const DPVersor* versor, SPVersor* result)
{
dp_versor_set(
(double)versor->_s0,
(double)versor->_x1,
(double)versor->_x2,
(double)versor->_x3,
result
);
}
static inline void dp_versor_copy_to_single(const DPVersor* versor, SPVersor* result)
{ {
sp_versor_set( sp_versor_set(
(float)versor->_s0, (float)versor->_s0,
@ -248,6 +237,17 @@ static inline void dp_versor_copy_to_single(const DPVersor* versor, SPVersor* re
); );
} }
static inline void dp_versor_from_single(const SPVersor* versor, DPVersor* result)
{
dp_versor_set(
(double)versor->_s0,
(double)versor->_x1,
(double)versor->_x2,
(double)versor->_x3,
result
);
}
// ================= Inversion ================== // // ================= Inversion ================== //
static inline void sp_versor_invert(SPVersor* versor) static inline void sp_versor_invert(SPVersor* versor)

View file

@ -1,162 +1,162 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64"> <ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion> <VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<ProjectGuid>{48dae315-715f-4044-adf5-0308483b887c}</ProjectGuid> <ProjectGuid>{48dae315-715f-4044-adf5-0308483b887c}</ProjectGuid>
<RootNamespace>geometry-test</RootNamespace> <RootNamespace>geometry-test</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="Shared"> <ImportGroup Label="Shared">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <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" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <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" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <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" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <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" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\src\geometry.vcxproj"> <ProjectReference Include="..\src\geometry.vcxproj">
<Project>{40ca6fb4-135f-4d54-a8d9-7338ba56e6a7}</Project> <Project>{40ca6fb4-135f-4d54-a8d9-7338ba56e6a7}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="geometry_test.c" /> <ClCompile Include="geometry_test.c" />
<ClCompile Include="main.c" /> <ClCompile Include="main.c" />
<ClCompile Include="sp_vector2_test.c" /> <ClCompile Include="sp_vector2_test.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="geometry_test.h" /> <ClInclude Include="geometry_test.h" />
<ClInclude Include="sp_vector2_test.h" /> <ClInclude Include="sp_vector2_test.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View file

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

View file

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