Завершение большого переименования
This commit is contained in:
parent
120e651517
commit
3805354611
31 changed files with 1213 additions and 1255 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
<CodeBlocks_workspace_file>
|
<CodeBlocks_workspace_file>
|
||||||
<Workspace title="Workspace">
|
<Workspace title="Workspace">
|
||||||
<Project filename="basic-geometry/basic-geometry.cbp" />
|
|
||||||
<Project filename="basic-geometry-dev/basic-geometry-dev.cbp">
|
<Project filename="basic-geometry-dev/basic-geometry-dev.cbp">
|
||||||
<Depends filename="basic-geometry/basic-geometry.cbp" />
|
<Depends filename="basic-geometry/basic-geometry.cbp" />
|
||||||
</Project>
|
</Project>
|
||||||
|
<Project filename="basic-geometry/basic-geometry.cbp" />
|
||||||
<Project filename="basic-geometry-test/basic-geometry-test.cbp">
|
<Project filename="basic-geometry-test/basic-geometry-test.cbp">
|
||||||
<Depends filename="basic-geometry/basic-geometry.cbp" />
|
<Depends filename="basic-geometry/basic-geometry.cbp" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@
|
||||||
#endif // _WINDOWS_
|
#endif // _WINDOWS_
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
versor_fp32_t versor1, versor2, result;
|
bgc_versor_fp32_t versor1, versor2, result;
|
||||||
//matrix3x3_fp32_t matrix;
|
//matrix3x3_fp32_t matrix;
|
||||||
vector3_fp32_t vector1, vector2;
|
bgc_vector3_fp32_t vector1, vector2;
|
||||||
} structure_fp32_t;
|
} structure_fp32_t;
|
||||||
|
|
||||||
structure_fp32_t* allocate_structures(const unsigned int amount)
|
structure_fp32_t* allocate_structures(const unsigned int amount)
|
||||||
|
|
@ -31,7 +31,7 @@ structure_fp32_t* make_structures(const unsigned int amount)
|
||||||
const float multiplier = 2.0f / RAND_MAX;
|
const float multiplier = 2.0f / RAND_MAX;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < amount; i++) {
|
for (unsigned int i = 0; i < amount; i++) {
|
||||||
versor_set_values_fp32(
|
bgc_versor_set_values_fp32(
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
|
|
@ -39,7 +39,7 @@ structure_fp32_t* make_structures(const unsigned int amount)
|
||||||
&list[i].versor1
|
&list[i].versor1
|
||||||
);
|
);
|
||||||
|
|
||||||
versor_set_values_fp32(
|
bgc_versor_set_values_fp32(
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
|
|
@ -47,49 +47,49 @@ structure_fp32_t* make_structures(const unsigned int amount)
|
||||||
&list[i].versor2
|
&list[i].versor2
|
||||||
);
|
);
|
||||||
|
|
||||||
versor_reset_fp32(&list[i].result);
|
bgc_versor_reset_fp32(&list[i].result);
|
||||||
|
|
||||||
//matrix3x3_set_to_identity_fp32(&list[i].matrix);
|
//matrix3x3_set_to_identity_fp32(&list[i].matrix);
|
||||||
|
|
||||||
vector3_set_values_fp32(
|
bgc_vector3_set_values_fp32(
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
&list[i].vector1
|
&list[i].vector1
|
||||||
);
|
);
|
||||||
|
|
||||||
vector3_reset_fp32(&list[i].vector2);
|
bgc_vector3_reset_fp32(&list[i].vector2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_versor_fp32(const versor_fp32_t* versor)
|
void print_versor_fp32(const bgc_versor_fp32_t* versor)
|
||||||
{
|
{
|
||||||
printf("Versor (%f, %f, %f, %f)\n", versor->s0, versor->x1, versor->x2, versor->x3);
|
printf("Versor (%f, %f, %f, %f)\n", versor->s0, versor->x1, versor->x2, versor->x3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_versor_fp64(const versor_fp64_t* versor)
|
void print_versor_fp64(const bgc_versor_fp64_t* versor)
|
||||||
{
|
{
|
||||||
printf("Versor (%lf, %lf, %lf, %lf)\n", versor->s0, versor->x1, versor->x2, versor->x3);
|
printf("Versor (%lf, %lf, %lf, %lf)\n", versor->s0, versor->x1, versor->x2, versor->x3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_vector_fp32(const vector3_fp32_t* vector)
|
void print_vector_fp32(const bgc_vector3_fp32_t* vector)
|
||||||
{
|
{
|
||||||
printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, vector3_get_modulus_fp32(vector));
|
printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp32(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_vector_fp64(const vector3_fp64_t* vector)
|
void print_vector_fp64(const bgc_vector3_fp64_t* vector)
|
||||||
{
|
{
|
||||||
printf("(%lf, %lf, %lf) / %lf\n", vector->x1, vector->x2, vector->x3, vector3_get_modulus_fp64(vector));
|
printf("(%lf, %lf, %lf) / %lf\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp64(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
void item_work(structure_fp32_t* item)
|
void item_work(structure_fp32_t* item)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 1000; j++) {
|
//for (int j = 0; j < 1000; j++) {
|
||||||
versor_combine_fp32(&item->versor1, &item->versor2, &item->result);
|
bgc_versor_combine_fp32(&item->versor1, &item->versor2, &item->result);
|
||||||
versor_turn_vector_fp32(&item->result, &item->vector1, &item->vector2);
|
bgc_versor_turn_vector_fp32(&item->result, &item->vector1, &item->vector2);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
@ -125,8 +125,8 @@ int main()
|
||||||
//for (int j = 0; j < 1000; j++) {
|
//for (int j = 0; j < 1000; j++) {
|
||||||
item_work(list + i);
|
item_work(list + i);
|
||||||
//structure_fp32_t* item = list + i;
|
//structure_fp32_t* item = list + i;
|
||||||
//versor_combine_fp32(&item->versor1, &item->versor2, &item->result);
|
//bgc_versor_combine_fp32(&item->versor1, &item->versor2, &item->result);
|
||||||
//versor_turn_vector_fp32(&item->result, &item->vector1, &item->vector2);
|
//bgc_versor_turn_vector_fp32(&item->result, &item->vector1, &item->vector2);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
const int TEST_FP32_VECTOR2_AMOUNT_1 = 5;
|
const int TEST_FP32_VECTOR2_AMOUNT_1 = 5;
|
||||||
|
|
||||||
const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1[] = {
|
const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1[] = {
|
||||||
{ 3.0f, 4.0f },
|
{ 3.0f, 4.0f },
|
||||||
{ -3.0f, -4.0f },
|
{ -3.0f, -4.0f },
|
||||||
{ 10000.0f, -20000.0f },
|
{ 10000.0f, -20000.0f },
|
||||||
|
|
@ -10,7 +10,7 @@ const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1[] = {
|
||||||
{ -123.5f, 3.7283f }
|
{ -123.5f, 3.7283f }
|
||||||
};
|
};
|
||||||
|
|
||||||
const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_2[] = {
|
const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_2[] = {
|
||||||
{ -3.0f, -4.0f },
|
{ -3.0f, -4.0f },
|
||||||
{ -3.0f, -4.0f },
|
{ -3.0f, -4.0f },
|
||||||
{ 0.002f, -0.05f },
|
{ 0.002f, -0.05f },
|
||||||
|
|
@ -29,9 +29,9 @@ int test_vector2_fp32_square_modulus()
|
||||||
float square_modulus;
|
float square_modulus;
|
||||||
|
|
||||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||||
square_modulus = vector2_get_square_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
square_modulus = bgc_vector2_get_square_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||||
|
|
||||||
if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_SQUARE_MODULUS_1[i], TEST_FP32_TWO_EPSYLON)) {
|
if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_SQUARE_MODULUS_1[i], TEST_BGC_TWO_EPSYLON_FP32)) {
|
||||||
print_test_failed();
|
print_test_failed();
|
||||||
return TEST_RESULT_FAILED;
|
return TEST_RESULT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
@ -52,9 +52,9 @@ int test_vector2_fp32_modulus()
|
||||||
float square_modulus;
|
float square_modulus;
|
||||||
|
|
||||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||||
square_modulus = vector2_get_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
square_modulus = bgc_vector2_get_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]);
|
||||||
|
|
||||||
if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_MODULUS_1[i], TEST_FP32_EPSYLON)) {
|
if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_MODULUS_1[i], TEST_BGC_EPSYLON_FP32)) {
|
||||||
print_test_failed();
|
print_test_failed();
|
||||||
return TEST_RESULT_FAILED;
|
return TEST_RESULT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +66,7 @@ int test_vector2_fp32_modulus()
|
||||||
|
|
||||||
// ===================== Add ==================== //
|
// ===================== Add ==================== //
|
||||||
|
|
||||||
const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = {
|
const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = {
|
||||||
{ 0.0f, 0.0f },
|
{ 0.0f, 0.0f },
|
||||||
{ -6.0f, -8.0f },
|
{ -6.0f, -8.0f },
|
||||||
{ 10000.002f, -20000.05f },
|
{ 10000.002f, -20000.05f },
|
||||||
|
|
@ -78,13 +78,13 @@ int test_vector2_add_fp32()
|
||||||
{
|
{
|
||||||
print_test_name("vector2_fp32_t add");
|
print_test_name("vector2_fp32_t add");
|
||||||
|
|
||||||
vector2_fp32_t vector;
|
bgc_vector2_fp32_t vector;
|
||||||
|
|
||||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||||
vector2_add_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
bgc_vector2_add_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||||
|
|
||||||
if (!test_are_equal_fp32(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x1, TEST_FP32_EPSYLON) ||
|
if (!test_are_equal_fp32(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x1, TEST_BGC_EPSYLON_FP32) ||
|
||||||
!test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x2, TEST_FP32_EPSYLON)) {
|
!test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x2, TEST_BGC_EPSYLON_FP32)) {
|
||||||
print_test_failed();
|
print_test_failed();
|
||||||
return TEST_RESULT_FAILED;
|
return TEST_RESULT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +96,7 @@ int test_vector2_add_fp32()
|
||||||
|
|
||||||
// ================== Subtract ================== //
|
// ================== Subtract ================== //
|
||||||
|
|
||||||
const vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = {
|
const bgc_vector2_fp32_t TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = {
|
||||||
{ 6.0f, 8.0f },
|
{ 6.0f, 8.0f },
|
||||||
{ 0.0f, 0.0f },
|
{ 0.0f, 0.0f },
|
||||||
{ 9999.998f, -19999.95f },
|
{ 9999.998f, -19999.95f },
|
||||||
|
|
@ -108,13 +108,13 @@ int test_vector2_subtract_fp32()
|
||||||
{
|
{
|
||||||
print_test_name("vector2_fp32_t subtract");
|
print_test_name("vector2_fp32_t subtract");
|
||||||
|
|
||||||
vector2_fp32_t vector;
|
bgc_vector2_fp32_t vector;
|
||||||
|
|
||||||
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
|
||||||
vector2_subtract_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
bgc_vector2_subtract_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector);
|
||||||
|
|
||||||
if (!test_are_equal_fp32(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x1, TEST_FP32_EPSYLON) ||
|
if (!test_are_equal_fp32(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x1, TEST_BGC_EPSYLON_FP32) ||
|
||||||
!test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x2, TEST_FP32_EPSYLON)) {
|
!test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x2, TEST_BGC_EPSYLON_FP32)) {
|
||||||
print_test_failed();
|
print_test_failed();
|
||||||
return TEST_RESULT_FAILED;
|
return TEST_RESULT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@
|
||||||
#define TEST_RESULT_SUCCES 0
|
#define TEST_RESULT_SUCCES 0
|
||||||
#define TEST_RESULT_FAILED 100
|
#define TEST_RESULT_FAILED 100
|
||||||
|
|
||||||
#define TEST_FP32_EPSYLON 1E-6f
|
#define TEST_BGC_EPSYLON_FP32 1E-6f
|
||||||
#define TEST_FP32_TWO_EPSYLON 2E-6f
|
#define TEST_BGC_TWO_EPSYLON_FP32 2E-6f
|
||||||
#define TEST_FP32_SQUARE_EPSYLON 1E-12f
|
#define TEST_BGC_SQUARE_EPSYLON_FP32 1E-12f
|
||||||
|
|
||||||
#define TEST_FP64_EPSYLON 1E-13f
|
#define TEST_BGC_EPSYLON_FP64 1E-13f
|
||||||
#define TEST_FP64_TWO_EPSYLON 2E-13f
|
#define TEST_BGC_TWO_EPSYLON_FP64 2E-13f
|
||||||
#define TEST_FP64_SQUARE_EPSYLON 1E-26f
|
#define TEST_BGC_SQUARE_EPSYLON_FP64 1E-26f
|
||||||
|
|
||||||
void print_test_section(const char * name);
|
void print_test_section(const char * name);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
#include "basis.h"
|
#include "utilities.h"
|
||||||
#include "angle.h"
|
#include "angle.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,102 +1,102 @@
|
||||||
#ifndef _BASIC_GEOMETRY_ANGLE_H_
|
#ifndef _BGC_ANGLE_H_
|
||||||
#define _BASIC_GEOMETRY_ANGLE_H_
|
#define _BGC_ANGLE_H_
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "basis.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
#define FP32_PI 3.1415926536f
|
#define BGC_PI_FP32 3.1415926536f
|
||||||
#define FP32_TWO_PI 6.2831853072f
|
#define BGC_TWO_PI_FP32 6.2831853072f
|
||||||
#define FP32_HALF_OF_PI 1.5707963268f
|
#define BGC_HALF_OF_PI_FP32 1.5707963268f
|
||||||
#define FP32_THIRD_OF_PI 1.0471975512f
|
#define BGC_THIRD_OF_PI_FP32 1.0471975512f
|
||||||
#define FP32_FOURTH_OF_PI 0.7853981634f
|
#define BGC_FOURTH_OF_PI_FP32 0.7853981634f
|
||||||
#define FP32_SIXTH_OF_PI 0.5235987756f
|
#define BGC_SIXTH_OF_PI_FP32 0.5235987756f
|
||||||
|
|
||||||
#define FP32_DEGREES_IN_RADIAN 57.295779513f
|
#define BGC_DEGREES_IN_RADIAN_FP32 57.295779513f
|
||||||
#define FP32_TURNS_IN_RADIAN 0.1591549431f
|
#define BGC_TURNS_IN_RADIAN_FP32 0.1591549431f
|
||||||
#define FP32_RADIANS_IN_DEGREE 1.745329252E-2f
|
#define BGC_RADIANS_IN_DEGREE_FP32 1.745329252E-2f
|
||||||
#define FP32_TURNS_IN_DEGREE 2.7777777778E-3f
|
#define BGC_TURNS_IN_DEGREE_FP32 2.7777777778E-3f
|
||||||
|
|
||||||
#define FP64_PI 3.14159265358979324
|
#define BGC_PI_FP64 3.14159265358979324
|
||||||
#define FP64_TWO_PI 6.28318530717958648
|
#define BGC_TWO_PI_FP64 6.28318530717958648
|
||||||
#define FP64_HALF_OF_PI 1.57079632679489662
|
#define BGC_HALF_OF_PI_FP64 1.57079632679489662
|
||||||
#define FP64_THIRD_OF_PI 1.04719755119659775
|
#define BGC_THIRD_OF_PI_FP64 1.04719755119659775
|
||||||
#define FP64_FOURTH_OF_PI 0.78539816339744831
|
#define BGC_FOURTH_OF_PI_FP64 0.78539816339744831
|
||||||
#define FP64_SIXTH_OF_PI 0.523598775598298873
|
#define BGC_SIXTH_OF_PI_FP64 0.523598775598298873
|
||||||
|
|
||||||
#define FP64_DEGREES_IN_RADIAN 57.2957795130823209
|
#define BGC_DEGREES_IN_RADIAN_FP64 57.2957795130823209
|
||||||
#define FP64_TURNS_IN_RADIAN 0.159154943091895336
|
#define BGC_TURNS_IN_RADIAN_FP64 0.159154943091895336
|
||||||
#define FP64_RADIANS_IN_DEGREE 1.74532925199432958E-2
|
#define BGC_RADIANS_IN_DEGREE_FP64 1.74532925199432958E-2
|
||||||
#define FP64_TURNS_IN_DEGREE 2.77777777777777778E-3
|
#define BGC_TURNS_IN_DEGREE_FP64 2.77777777777777778E-3
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BG_ANGLE_UNIT_RADIANS = 1,
|
BGC_ANGLE_UNIT_RADIANS = 1,
|
||||||
BG_ANGLE_UNIT_DEGREES = 2,
|
BGC_ANGLE_UNIT_DEGREES = 2,
|
||||||
BG_ANGLE_UNIT_TURNS = 3
|
BGC_ANGLE_UNIT_TURNS = 3
|
||||||
} angle_unit_t;
|
} bgc_angle_unit_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/**
|
/**
|
||||||
* The measure of an angle with a range of:
|
* The measure of an angle with a range of:
|
||||||
* [0, 360) degrees, [0, 2xPI) radians, [0, 1) turns, [0, 400) gradians
|
* [0, 360) degrees, [0, 2xPI) radians, [0, 1) turns, [0, 400) gradians
|
||||||
*/
|
*/
|
||||||