Добавлены матрицы 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" ?>
<CodeBlocks_workspace_layout_file>
<FileVersion major="1" minor="0" />
<ActiveProject path="dev/geometry-dev.cbp" />
<ActiveProject path="src/geometry.cbp" />
<PreferredTarget name="Debug" />
</CodeBlocks_workspace_layout_file>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<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">
<Cursor>
<Cursor1 position="3262" topLine="102" />
<Cursor1 position="3793" topLine="116" />
</Cursor>
</File>
</CodeBlocks_layout_file>

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\n", matrix->r3c1, matrix->r3c2, matrix->r3c3);
}
/*
int main()
{
DPMatrix3x3 m1, m2, check;
@ -170,3 +170,18 @@ int main()
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" />
</Unit>
<Unit filename="matrix2x2.h" />
<Unit filename="matrix2x3.h" />
<Unit filename="matrix3x2.h" />
<Unit filename="matrix3x3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrix3x3.h" />
<Unit filename="matrixes.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrixes.h" />
<Unit filename="quaternion.c">
<Option compilerVar="CC" />
</Unit>

View file

@ -8,7 +8,9 @@
#include "vector2.h"
#include "vector3.h"
#include "matrixes.h"
#include "matrix2x2.h"
#include "matrix2x3.h"
#include "matrix3x3.h"
#include "rotation3.h"

View file

@ -2,59 +2,19 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<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>
<Cursor1 position="3207" topLine="198" />
<Cursor1 position="1849" topLine="67" />
</Cursor>
</File>
<File name="angle.c" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="vector2.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="2293" topLine="74" />
</Cursor>
</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>
<Cursor1 position="6363" topLine="266" />
</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" />
<Cursor1 position="103" topLine="0" />
</Cursor>
</File>
<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" />
</Cursor>
</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>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="23" topLine="72" />
</Cursor>
</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>
<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>
</File>
<File name="matrix2x2.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6700" topLine="238" />
<Cursor1 position="2885" topLine="183" />
</Cursor>
</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>
<Cursor1 position="3718" topLine="116" />
<Cursor1 position="2779" topLine="79" />
</Cursor>
</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>
<Cursor1 position="20" 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" />
<Cursor1 position="27" topLine="0" />
</Cursor>
</File>
<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" />
</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="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>

View file

@ -1,24 +1 @@
#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

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

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -3,24 +3,7 @@
#include "angle.h"
#include "vector2.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;
#include "matrixes.h"
// =================== Reset ==================== //
@ -124,22 +107,24 @@ static inline void dp_matrix2x2_copy(const DPMatrix2x2* from, DPMatrix2x2* to)
// ============= Copy to twin type ============== //
static inline void sp_matrix2x2_copy_to_double(const SPMatrix2x2* from, DPMatrix2x2* 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)