Большое переупорядочивание исходного кода
This commit is contained in:
parent
fffe2be43b
commit
43bf030295
26 changed files with 1225 additions and 1137 deletions
|
|
@ -27,10 +27,11 @@
|
|||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
<Add option="-O3" />
|
||||
<Add directory="../basic-geometry" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-O3" />
|
||||
<Add option="-s" />
|
||||
<Add library="basic-geometry" />
|
||||
<Add library="m" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/*
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
|
@ -12,8 +11,6 @@
|
|||
|
||||
typedef struct {
|
||||
BgcVersorFP32 versor1, versor2, result;
|
||||
//BgcMatrix3x3FP32 matrix;
|
||||
//BgcVector3FP32 vector1, vector2;
|
||||
} structure_fp32_t;
|
||||
|
||||
structure_fp32_t* allocate_structures(const unsigned int amount)
|
||||
|
|
@ -49,18 +46,6 @@ structure_fp32_t* make_structures(const unsigned int amount)
|
|||
);
|
||||
|
||||
bgc_versor_reset_fp32(&list[i].result);
|
||||
|
||||
//bgc_matrix3x3_set_to_identity_fp32(&list[i].matrix);
|
||||
/*
|
||||
bgc_vector3_set_values_fp32(
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
&list[i].vector1
|
||||
);
|
||||
|
||||
bgc_vector3_reset_fp32(&list[i].vector2);
|
||||
*//*
|
||||
}
|
||||
|
||||
return list;
|
||||
|
|
@ -94,7 +79,7 @@ void list_work(const uint_fast32_t amount, structure_fp32_t* list)
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
int main()
|
||||
{
|
||||
const unsigned int amount = 1000000;
|
||||
|
|
@ -136,18 +121,3 @@ int main()
|
|||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector3FP32 my_vector;
|
||||
|
||||
bgc_vector3_set_values_fp32(-2, 7, 10, &my_vector);
|
||||
|
||||
printf("x1 = %f, x2 = %f, x3 = %f\n", my_vector.x1, my_vector.x2, my_vector.x3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,13 +106,13 @@ static const float _TEST_FP32_DATA_SQUARE_NONUNIT[] = {
|
|||
1.0f - 2.25f * BGC_EPSYLON_FP32
|
||||
};
|
||||
|
||||
int test_is_sqare_value_unit_fp32()
|
||||
int test_is_sqare_unit_fp32()
|
||||
{
|
||||
print_testing_name("bgc_is_sqare_value_unit_fp32");
|
||||
print_testing_name("bgc_is_sqare_unit_fp32");
|
||||
|
||||
// Testing unit values:
|
||||
for (int i = 0; i < _TEST_FP32_DATA_SQUARE_UNIT_AMOUNT; i++) {
|
||||
if (!bgc_is_sqare_value_unit_fp32(_TEST_FP32_DATA_SQUARE_UNIT[i])) {
|
||||
if (!bgc_is_sqare_unit_fp32(_TEST_FP32_DATA_SQUARE_UNIT[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ int test_is_sqare_value_unit_fp32()
|
|||
|
||||
// Testing non-unit values:
|
||||
for (int i = 0; i < _TEST_FP32_DATA_SQUARE_NONUNIT_AMOUNT; i++) {
|
||||
if (bgc_is_sqare_value_unit_fp32(_TEST_FP32_DATA_SQUARE_NONUNIT[i])) {
|
||||
if (bgc_is_sqare_unit_fp32(_TEST_FP32_DATA_SQUARE_NONUNIT[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
|
@ -149,13 +149,13 @@ static const double _TEST_FP64_DATA_SQUARE_NONUNIT[] = {
|
|||
1.0 - 2.25 * BGC_EPSYLON_FP64
|
||||
};
|
||||
|
||||
int test_is_sqare_value_unit_fp64()
|
||||
int test_is_sqare_unit_fp64()
|
||||
{
|
||||
print_testing_name("bgc_is_sqare_value_unit_fp64");
|
||||
print_testing_name("bgc_is_sqare_unit_fp64");
|
||||
|
||||
// Testing unit values:
|
||||
for (int i = 0; i < _TEST_FP64_DATA_SQUARE_UNIT_AMOUNT; i++) {
|
||||
if (!bgc_is_sqare_value_unit_fp64(_TEST_FP64_DATA_SQUARE_UNIT[i])) {
|
||||
if (!bgc_is_sqare_unit_fp64(_TEST_FP64_DATA_SQUARE_UNIT[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ int test_is_sqare_value_unit_fp64()
|
|||
|
||||
// Testing non-unit values:
|
||||
for (int i = 0; i < _TEST_FP64_DATA_SQUARE_NONUNIT_AMOUNT; i++) {
|
||||
if (bgc_is_sqare_value_unit_fp64(_TEST_FP64_DATA_SQUARE_NONUNIT[i])) {
|
||||
if (bgc_is_sqare_unit_fp64(_TEST_FP64_DATA_SQUARE_NONUNIT[i])) {
|
||||
print_testing_failed();
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
|
@ -184,11 +184,11 @@ int test_is_unit()
|
|||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_is_sqare_value_unit_fp32() != TEST_SUCCES) {
|
||||
if (test_is_sqare_unit_fp32() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
if (test_is_sqare_value_unit_fp64() != TEST_SUCCES) {
|
||||
if (test_is_sqare_unit_fp64() != TEST_SUCCES) {
|
||||
return TEST_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ int test_is_unit_fp32();
|
|||
|
||||
int test_is_unit_fp64();
|
||||
|
||||
int test_is_sqare_value_unit_fp32();
|
||||
int test_is_sqare_unit_fp32();
|
||||
|
||||
int test_is_sqare_value_unit_fp64();
|
||||
int test_is_sqare_unit_fp64();
|
||||
|
||||
int test_is_unit();
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ int test_vector2_fp32_square_modulus()
|
|||
return TEST_SUCCES;
|
||||
}
|
||||
|
||||
// =================== Module =================== //
|
||||
// ================== Modulus =================== //
|
||||
|
||||
const float FP32_VECTOR2_MODULUS_1[] = { 5.0f, 5.0f, 22360.68f, 10.0005f, 123.55626338f };
|
||||
|
||||
|
|
@ -180,4 +180,4 @@ int test_fp32_vector2()
|
|||
|
||||
return TEST_SUCCES;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,7 +52,13 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="matrix2x2.h" />
|
||||
<Unit filename="matrix2x3.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="matrix2x3.h" />
|
||||
<Unit filename="matrix3x2.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="matrix3x2.h" />
|
||||
<Unit filename="matrix3x3.c">
|
||||
<Option compilerVar="CC" />
|
||||
|
|
|
|||
|
|
@ -9,8 +9,14 @@ extern inline void bgc_matrix2x2_set_to_identity_fp64(BgcMatrix2x2FP64* matrix);
|
|||
extern inline void bgc_matrix2x2_set_to_diagonal_fp32(const float d1, const float d2, BgcMatrix2x2FP32* matrix);
|
||||
extern inline void bgc_matrix2x2_set_to_diagonal_fp64(const double d1, const double d2, BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline void bgc_matrix2x2_make_rotation_fp32(const float angle, const BgcAngleUnitEnum unit, BgcMatrix2x2FP32* matrix);
|
||||
extern inline void bgc_matrix2x2_make_rotation_fp64(const double angle, const BgcAngleUnitEnum unit, BgcMatrix2x2FP64* matrix);
|
||||
extern inline void bgc_matrix2x2_set_turn_fp32(const float angle, const BgcAngleUnitEnum unit, BgcMatrix2x2FP32* matrix);
|
||||
extern inline void bgc_matrix2x2_set_turn_fp64(const double angle, const BgcAngleUnitEnum unit, BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline float bgc_matrix2x2_get_determinant_fp32(const BgcMatrix2x2FP32* matrix);
|
||||
extern inline double bgc_matrix2x2_get_determinant_fp64(const BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline int bgc_matrix2x2_is_singular_fp32(const BgcMatrix2x2FP32* matrix);
|
||||
extern inline int bgc_matrix2x2_is_singular_fp64(const BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline void bgc_matrix2x2_copy_fp32(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP32* to);
|
||||
extern inline void bgc_matrix2x2_copy_fp64(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP64* to);
|
||||
|
|
@ -21,23 +27,11 @@ extern inline void bgc_matrix2x2_swap_fp64(BgcMatrix2x2FP64* matrix1, BgcMatrix2
|
|||
extern inline void bgc_matrix2x2_convert_fp64_to_fp32(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP32* to);
|
||||
extern inline void bgc_matrix2x2_convert_fp32_to_fp64(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP64* to);
|
||||
|
||||
extern inline float bgc_matrix2x2_get_determinant_fp32(const BgcMatrix2x2FP32* matrix);
|
||||
extern inline double bgc_matrix2x2_get_determinant_fp64(const BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline int bgc_matrix2x2_is_singular_fp32(const BgcMatrix2x2FP32* matrix);
|
||||
extern inline int bgc_matrix2x2_is_singular_fp64(const BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline void bgc_matrix2x2_transpose_fp32(BgcMatrix2x2FP32* matrix);
|
||||
extern inline void bgc_matrix2x2_transpose_fp64(BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline int bgc_matrix2x2_invert_fp32(BgcMatrix2x2FP32* matrix);
|
||||
extern inline int bgc_matrix2x2_invert_fp64(BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline void bgc_matrix2x2_set_transposed_fp32(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP32* to);
|
||||
extern inline void bgc_matrix2x2_set_transposed_fp64(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP64* to);
|
||||
|
||||
extern inline int bgc_matrix2x2_set_inverted_fp32(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP32* to);
|
||||
extern inline int bgc_matrix2x2_set_inverted_fp64(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP64* to);
|
||||
extern inline void bgc_matrix2x2_transpose_fp32(BgcMatrix2x2FP32* matrix);
|
||||
extern inline void bgc_matrix2x2_transpose_fp64(BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline void bgc_matrix2x2_set_row1_fp32(const float c1, const float c2, BgcMatrix2x2FP32* matrix);
|
||||
extern inline void bgc_matrix2x2_set_row1_fp64(const double c1, const double c2, BgcMatrix2x2FP64* matrix);
|
||||
|
|
@ -51,6 +45,12 @@ extern inline void bgc_matrix2x2_set_column1_fp64(const double r1, const double
|
|||
extern inline void bgc_matrix2x2_set_column2_fp32(const float r1, const float r2, BgcMatrix2x2FP32* matrix);
|
||||
extern inline void bgc_matrix2x2_set_column2_fp64(const double r1, const double r2, BgcMatrix2x2FP64* matrix);
|
||||
|
||||
extern inline int bgc_matrix2x2_make_inverted_fp32(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP32* to);
|
||||
extern inline int bgc_matrix2x2_make_inverted_fp64(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP64* to);
|
||||
|
||||
extern inline void bgc_matrix2x2_make_transposed_fp32(const BgcMatrix2x2FP32* from, BgcMatrix2x2FP32* to);
|
||||
extern inline void bgc_matrix2x2_make_transposed_fp64(const BgcMatrix2x2FP64* from, BgcMatrix2x2FP64* to);
|
||||
|
||||
extern inline void bgc_matrix2x2_add_fp32(const BgcMatrix2x2FP32* matrix1, const BgcMatrix2x2FP32* matrix2, BgcMatrix2x2FP32* sum);
|
||||
extern inline void bgc_matrix2x2_add_fp64(const BgcMatrix2x2FP64* matrix1, const BgcMatrix2x2FP64* matrix2, BgcMatrix2x2FP64* sum);
|
||||
|
||||
|
|
@ -60,14 +60,18 @@ extern inline void bgc_matrix2x2_add_scaled_fp64(const BgcMatrix2x2FP64* basic_m
|
|||
extern inline void bgc_matrix2x2_subtract_fp32(const BgcMatrix2x2FP32* minuend, const BgcMatrix2x2FP32* subtrahend, BgcMatrix2x2FP32* difference);
|
||||
extern inline void bgc_matrix2x2_subtract_fp64(const BgcMatrix2x2FP64* minuend, const BgcMatrix2x2FP64* subtrahend, BgcMatrix2x2FP64* difference);
|
||||
|
||||
extern inline void bgc_matrix2x2_subtract_scaled_fp32(const BgcMatrix2x2FP32* basic_matrix, const BgcMatrix2x2FP32* scalable_matrix, const float scale, BgcMatrix2x2FP32* difference);
|
||||
extern inline void bgc_matrix2x2_subtract_scaled_fp64(const BgcMatrix2x2FP64* basic_matrix, const BgcMatrix2x2FP64* scalable_matrix, const double scale, BgcMatrix2x2FP64* difference);
|
||||
|
||||
extern inline void bgc_matrix2x2_multiply_fp32(const BgcMatrix2x2FP32* multiplicand, const float multiplier, BgcMatrix2x2FP32* product);
|
||||
extern inline void bgc_matrix2x2_multiply_fp64(const BgcMatrix2x2FP64* multiplicand, const double multiplier, BgcMatrix2x2FP64* product);
|
||||
|
||||
extern inline void bgc_matrix2x2_divide_fp32(const BgcMatrix2x2FP32* dividend, const float divisor, BgcMatrix2x2FP32* quotient);
|
||||
extern inline void bgc_matrix2x2_divide_fp64(const BgcMatrix2x2FP64* dividend, const double divisor, BgcMatrix2x2FP64* quotient);
|
||||
|
||||
extern inline void bgc_matrix2x2_left_product_fp32(const BgcVector2FP32* vector, const BgcMatrix2x2FP32* matrix, BgcVector2FP32* result);
|
||||
extern inline void bgc_matrix2x2_left_product_fp64(const BgcVector2FP64* vector, const BgcMatrix2x2FP64* matrix, BgcVector2FP64* result);
|
||||
extern inline void bgc_matrix2x2_left_product_fp32(const BgcVector2FP32* vector, const BgcMatrix2x2FP32* matrix, BgcVector2FP32* product);
|
||||
extern inline void bgc_matrix2x2_left_product_fp64(const BgcVector2FP64* vector, const BgcMatrix2x2FP64* matrix, BgcVector2FP64* product);
|
||||
|
||||
extern inline void bgc_matrix2x2_right_product_fp32(const BgcMatrix2x2FP32* matrix, const BgcVector2FP32* vector, BgcVector2FP32* product);
|
||||
extern inline void bgc_matrix2x2_right_product_fp64(const BgcMatrix2x2FP64* matrix, const BgcVector2FP64* vector, BgcVector2FP64* product);
|
||||
|
||||
extern inline void bgc_matrix2x2_right_product_fp32(const BgcMatrix2x2FP32* matrix, const BgcVector2FP32* vector, BgcVector2FP32* result);
|
||||
extern inline void bgc_matrix2x2_right_product_fp64(const BgcMatrix2x2FP64* matrix, const BgcVector2FP64* vector, BgcVector2FP64* result);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ inline void bgc_matrix2x2_set_to_diagonal_fp64(const double d1, const double d2,
|
|||
|
||||
// ============== Rotation Matrix =============== //
|
||||
|
||||