Compare commits

..

9 commits

Author SHA1 Message Date
57280ac3f3 Добавление арифметических операций для дуальных чисел, векторов и кватернионов 2026-02-05 01:58:09 +07:00
b0b064de5a Добавление арифметических операций для дуальных кватернионов 2026-02-05 01:47:52 +07:00
b470a3194b Отказ от терминов Versor и Cotes Number в пользу Turn3 и Turn2, использование кватернионов внутри Turn3 2026-02-04 21:02:15 +07:00
38cff7e27d Добавление арифметических операций для дуальных кватернионов 2026-02-04 03:44:09 +07:00
b87518cd3f Развитие дуальный чисел, векторов и кватернионов, а также гомогенных векторов и матриц 2026-02-03 19:56:56 +07:00
3f96b661a9 Добавление дуальных чисел, дуальных векторов (3D) и дуальных версоров 2026-02-03 03:33:53 +07:00
043cc72c81 Небольшие исправления, а также добавление гомогенного трёхмерного вектора 2026-02-02 20:44:10 +07:00
03627f4401 Переход на парадигму Destination first в порядке параметров функий 2026-02-01 23:42:51 +07:00
f7e41645fe Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций 2026-01-30 19:37:49 +07:00
110 changed files with 7242 additions and 6325 deletions

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_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>

View file

@ -8,7 +8,7 @@
Programming language: C (C99) Programming language: C (C99)
Version: 0.2.0-dev Version: 0.3.0-dev
License: Apache-2.0 License: Apache-2.0

View file

@ -10,7 +10,7 @@
Язык программирования: Си (C99) Язык программирования: Си (C99)
Версия: 0.2.0-dev Версия: 0.3.0-dev
Лицензия: Apache-2.0 Лицензия: Apache-2.0

View file

@ -9,16 +9,16 @@
#include <time.h> #include <time.h>
#endif // _WINDOWS_ #endif // _WINDOWS_
BgcAffine3FP32* _create_bgc_affine3_list(int affine_amount) BGC_FP32_Affine3* _create_bgc_affine3_list(int affine_amount)
{ {
BgcAffine3FP32* affines = malloc(affine_amount * sizeof(BgcAffine3FP32)); BGC_FP32_Affine3* affines = malloc(affine_amount * sizeof(BGC_FP32_Affine3));
if (affines == 0) { if (affines == 0) {
return 0; return 0;
} }
for (int i = 0; i < affine_amount; i++) { for (int i = 0; i < affine_amount; i++) {
bgc_affine3_reset_fp32(&affines[i]); bgc_fp32_affine3_reset(&affines[i]);
} }
return affines; return affines;
@ -29,43 +29,43 @@ float get_random_value_fp32()
return rand() * (2.0f / RAND_MAX) - 1.0f; return rand() * (2.0f / RAND_MAX) - 1.0f;
} }
BgcAffine3FP32* _create_bgc_affine3_random_list(int affine_amount) BGC_FP32_Affine3* _create_bgc_affine3_random_list(int affine_amount)
{ {
BgcAffine3FP32* affines = malloc(affine_amount * sizeof(BgcAffine3FP32)); BGC_FP32_Affine3* affines = malloc(affine_amount * sizeof(BGC_FP32_Affine3));
if (affines == 0) { if (affines == 0) {
return 0; return 0;
} }
BgcPosition3FP32 position; BGC_FP32_Position3 position;
for (int i = 0; i < affine_amount; i++) { for (int i = 0; i < affine_amount; i++) {
bgc_versor_set_values_fp32( bgc_fp32_turn3_set_raw_values(
&position.turn,
get_random_value_fp32(), get_random_value_fp32(),
get_random_value_fp32(), get_random_value_fp32(),
get_random_value_fp32(), get_random_value_fp32(),
get_random_value_fp32(), get_random_value_fp32()
&position.turn
); );
position.shift.x1 = get_random_value_fp32(); position.shift.x1 = get_random_value_fp32();
position.shift.x2 = get_random_value_fp32(); position.shift.x2 = get_random_value_fp32();
position.shift.x3 = get_random_value_fp32(); position.shift.x3 = get_random_value_fp32();
bgc_position3_get_outward_affine_fp32(&position, &affines[i]); bgc_fp32_position3_get_outward_affine(&affines[i], &position);
} }
return affines; return affines;
} }
BgcVector3FP32* _create_bgc_vector3_list(int amount) BGC_FP32_Vector3* _create_bgc_vector3_list(int amount)
{ {
return malloc(amount * sizeof(BgcVector3FP32)); return malloc(amount * sizeof(BGC_FP32_Vector3));
} }
BgcVector3FP32* _create_bgc_vector3_random_list(int amount) BGC_FP32_Vector3* _create_bgc_vector3_random_list(int amount)
{ {
BgcVector3FP32* vectors = _create_bgc_vector3_list(amount); BGC_FP32_Vector3* vectors = _create_bgc_vector3_list(amount);
if (vectors == 0) { if (vectors == 0) {
return 0; return 0;
@ -82,9 +82,9 @@ BgcVector3FP32* _create_bgc_vector3_random_list(int amount)
float test_bgc_affine3_performance(int affine_amount, int vector_per_affine) float test_bgc_affine3_performance(int affine_amount, int vector_per_affine)
{ {
BgcAffine3FP32* affines; BGC_FP32_Affine3* affines;
BgcVector3FP32* source_vectors; BGC_FP32_Vector3* source_vectors;
BgcVector3FP32* result_vectors; BGC_FP32_Vector3* result_vectors;
int vector_index = 0; int vector_index = 0;
float time = -1.0f; float time = -1.0f;
@ -131,7 +131,7 @@ float test_bgc_affine3_performance(int affine_amount, int vector_per_affine)
for (int i = 0; i < affine_amount; i++) for (int i = 0; i < affine_amount; i++)
{ {
for (int j = 0; j < vector_per_affine; j++) { for (int j = 0; j < vector_per_affine; j++) {
bgc_affine3_transform_point_fp32(&affines[i], &source_vectors[vector_index], &result_vectors[vector_index]); bgc_fp32_affine3_transform_point(&result_vectors[vector_index], &affines[i], &source_vectors[vector_index]);
vector_index++; vector_index++;
} }
} }
@ -153,4 +153,4 @@ float test_bgc_affine3_performance(int affine_amount, int vector_per_affine)
free(affines); free(affines);
return time; return time;
} }

View file

@ -10,7 +10,7 @@
#endif // _WINDOWS_ #endif // _WINDOWS_
typedef struct { typedef struct {
BgcVersorFP32 versor1, versor2, result; BGC_FP32_Turn3 versor1, versor2, result;
} structure_fp32_t; } structure_fp32_t;
structure_fp32_t* allocate_structures(const unsigned int amount) structure_fp32_t* allocate_structures(const unsigned int amount)
@ -29,57 +29,57 @@ 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++) {
bgc_versor_set_values_fp32( bgc_fp32_turn3_set_raw_values(
&list[i].versor1,
rand() * multiplier - 1.0f, rand() * multiplier - 1.0f,
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].versor1
); );
bgc_versor_set_values_fp32( bgc_fp32_turn3_set_raw_values(
&list[i].versor2,
rand() * multiplier - 1.0f, rand() * multiplier - 1.0f,
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].versor2
); );
bgc_versor_reset_fp32(&list[i].result); bgc_fp32_turn3_reset(&list[i].result);
} }
return list; return list;
} }
void print_versor_fp32(const BgcVersorFP32* versor) void print_quaternion_fp32(const BGC_FP32_Quaternion* quaternion)
{ {
printf("Versor (s0 = %0.12f, x1 = %0.12f, x2 = %0.12f, x3 = %0.12f)\n", versor->_s0, versor->_x1, versor->_x2, versor->_x3); printf("Quaternion FP32(s0 = %0.12f, x1 = %0.12f, x2 = %0.12f, x3 = %0.12f)\n", quaternion->s0, quaternion->x1, quaternion->x2, quaternion->x3);
} }
void print_versor_fp64(const BgcVersorFP64* versor) void print_quaternion_fp64(const BGC_FP64_Quaternion* quaternion)
{ {
printf("Versor (s0 = %0.20f, x1 = %0.20f, x2 = %0.20f, x3 = %0.20f)\n", versor->_s0, versor->_x1, versor->_x2, versor->_x3); printf("Quaternion FP64(s0 = %0.12f, x1 = %0.12f, x2 = %0.12f, x3 = %0.12f)\n", quaternion->s0, quaternion->x1, quaternion->x2, quaternion->x3);
} }
void print_vector_fp32(const BgcVector3FP32* vector) void print_vector_fp32(const BGC_FP32_Vector3* vector)
{ {
printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp32(vector)); printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, bgc_fp32_vector3_get_modulus(vector));
} }
void print_vector_fp64(const BgcVector3FP64* vector) void print_vector_fp64(const BGC_FP64_Vector3* vector)
{ {
printf("(%lf, %lf, %lf) / %lf\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp64(vector)); printf("(%lf, %lf, %lf) / %lf\n", vector->x1, vector->x2, vector->x3, bgc_fp64_vector3_get_modulus(vector));
} }
void list_work(const uint_fast32_t amount, structure_fp32_t* list) void list_work(const uint_fast32_t amount, structure_fp32_t* list)
{ {
for (uint_fast32_t j = 0; j < 1000; j++) { for (uint_fast32_t j = 0; j < 1000; j++) {
for (uint_fast32_t i = 0; i < amount; i++) { for (uint_fast32_t i = 0; i < amount; i++) {
bgc_versor_combine_fp32(&list[i].versor1, &list[i].versor1, &list[i].result); bgc_fp32_turn3_combine(&list[i].result, &list[i].versor1, &list[i].versor2);
} }
} }
} }
/*
int main() int main()
{ {
const unsigned int amount = 1000000; const unsigned int amount = 1000000;
@ -113,25 +113,25 @@ int main()
printf("Time: %lf\n", (end.tv_sec - start.tv_sec) * 1000.0 + (end.tv_nsec - start.tv_nsec) * 0.000001); printf("Time: %lf\n", (end.tv_sec - start.tv_sec) * 1000.0 + (end.tv_nsec - start.tv_nsec) * 0.000001);
#endif // _WIN64 #endif // _WIN64
print_versor_fp32(&list[10].versor1); print_quaternion_fp32(&list[10].versor1._versor);
print_versor_fp32(&list[10].versor2); print_quaternion_fp32(&list[10].versor2._versor);
print_versor_fp32(&list[10].result); print_quaternion_fp32(&list[10].result._versor);
free(list); free(list);
return 0; return 0;
} }
*/
/* /*
int main() { int main() {
BgcComplexFP32 complex, exponent, result; BGC_FP32_Complex complex, exponent, result;
bgc_complex_set_values_fp32(0, 1, &complex); bgc_fp32_complex_make(0, 1, &complex);
bgc_complex_set_values_fp32(4, 0, &exponent); bgc_fp32_complex_make(4, 0, &exponent);
bgc_complex_get_exponation_fp32(&complex, exponent.real, exponent.imaginary, &result); bgc_fp32_complex_get_exponation(&complex, exponent.real, exponent.imaginary, &result);
printf("(%f, %f) ^ (%f, %f) = (%f, %f)\n", complex.real, complex.imaginary, exponent.real, exponent.imaginary, result.real, result.imaginary); printf("(%f, %f) ^ (%f, %f) = (%f, %f)\n", complex.real, complex.imaginary, exponent.real, exponent.imaginary, result.real, result.imaginary);
@ -140,10 +140,10 @@ int main() {
*/ */
/* /*
int main() { int main() {
BgcVersorFP32 start = { 1.0f, 0.0f, 0.0f, 0.0f }; BGC_FP32_Turn3 start = { 1.0f, 0.0f, 0.0f, 0.0f };
BgcVersorFP32 end = { 0.0f, 1.0f, 0.0f, 0.0f }; BGC_FP32_Turn3 end = { 0.0f, 1.0f, 0.0f, 0.0f };
BgcVersorFP32 result; BGC_FP32_Turn3 result;
bgc_versor_spherical_interpolation_fp32(&start, &end, 0.5f, &result); bgc_fp32_turn3_spherical_interpolation(&start, &end, 0.5f, &result);
printf("Result: %0.12f, %0.12f, %0.12f, %0.12f\n", result.s0, result.x1, result.x2, result.x3); printf("Result: %0.12f, %0.12f, %0.12f, %0.12f\n", result.s0, result.x1, result.x2, result.x3);
return 0; return 0;
} }
@ -152,346 +152,347 @@ int main() {
void test_basis_difference_fp32() void test_basis_difference_fp32()
{ {
BgcVector3FP32 initial_primary, initial_auxiliary; BGC_FP32_Vector3 initial_primary, initial_auxiliary;
BgcVector3FP32 final_primary, final_auxiliary; BGC_FP32_Vector3 final_primary, final_auxiliary;
BgcVersorFP32 turn; BGC_FP32_Turn3 turn;
// No turn // No turn
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nNo turn:\n"); printf("\nNo turn:\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// Turn around (1, 1, 0) axis on 180 degrees // Turn around (1, 1, 0) axis on 180 degrees
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, 1.0f, 0.0f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nTurn around (1, 1, 0) axis on 180 degrees:\n"); printf("\nTurn around (1, 1, 0) axis on 180 degrees:\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// 180 degree turn // 180 degree turn
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(-1.0f, 0.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, -1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\n180 degree turn around (0, 1, 0):\n"); printf("\n180 degree turn around (0, 1, 0):\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// 90 degree turn around x3 axis // 90 degree turn around x3 axis
bgc_vector3_set_values_fp32(2.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 2.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 3.1f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.0f, 3.1f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 10.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 0.0f, 10.0f, 0.0f);
bgc_vector3_set_values_fp32(-1.0f, 0.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary,-1.0f, 0.0f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\n90 degree turn around (0, 0, 1):\n"); printf("\n90 degree turn around (0, 0, 1):\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// Unorthogonal pairs turn at 90 degrees around x3 axis // Unorthogonal pairs turn at 90 degrees around x3 axis
bgc_vector3_set_values_fp32(2.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 2.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(-2.0f, 3.1f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, -2.0f, 3.1f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 10.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 0.0f, 10.0f, 0.0f);
bgc_vector3_set_values_fp32(-1.0f, 5.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, -1.0f, 5.0f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nUnorthogonal pairs turn at 90 degrees around (0, 0, 1):\n"); printf("\nUnorthogonal pairs turn at 90 degrees around (0, 0, 1):\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// Zero vectors // Zero vectors
bgc_vector3_set_values_fp32(0.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 0.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, 0.0f, 1.0f, 0.0f);
int code; int code;
code = bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); code = bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
if (code >= 0) { if (code >= 0) {
printf("\nZero vectors: this cannot be!\n"); printf("\nZero vectors: this cannot be!\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
} }
else { else {
printf("\nZero vector validation works fine\n"); printf("\nZero vector validation works fine\n");
} }
// Parallel vectors // Parallel vectors
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(2.0f, 0.0f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 2.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, 0.0f, 1.0f, 0.0f);
code = bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); code = bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
if (code >= 0) { if (code >= 0) {
printf("\nParallel vectors: this cannot be!\n"); printf("\nParallel vectors: this cannot be!\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
} }
else { else {
printf("\nParallelism validation works fine\n"); printf("\nParallelism validation works fine\n");
} }
// Small angle turn (about 1 degree): // Small angle turn (about 1 degree):
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(0.999848f, 0.017452f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 0.999848f, 0.017452f, 0.0f);
bgc_vector3_set_values_fp32(-0.017452f, 0.999848f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, -0.017452f, 0.999848f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn , &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nSmall angle turn (about 1 degree):\n"); printf("\nSmall angle turn (about 1 degree):\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// About 179 degrees turn // About 179 degrees turn
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(-0.999848f, -0.017452f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, -0.999848f, -0.017452f, 0.0f);
bgc_vector3_set_values_fp32(0.017452f, -0.999848f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, 0.017452f, -0.999848f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nAbout 179 degrees turn:\n"); printf("\nAbout 179 degrees turn:\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// 120 degrees around (-1, -1, 1) // 120 degrees around (-1, -1, 1)
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 0.0f, -1.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, 0.0f, 0.0f, -1.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\n120 degees turn:\n"); printf("\n120 degees turn:\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// About 1 degree turn difference between initial_primary and initial_auxiliary directions // About 1 degree turn difference between initial_primary and initial_auxiliary directions
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(0.999848f, 0.017452f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 0.999848f, 0.017452f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, 1.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 0.0f, 1.0f, 0.0f);
bgc_vector3_set_values_fp32(-1.0f, 0.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, -1.0f, 0.0f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nAbout 1 degree turn difference between initial_primary and initial_auxiliary directions:\n"); printf("\nAbout 1 degree turn difference between initial_primary and initial_auxiliary directions:\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
// About 0.01 degree turn difference between initial_primary and initial_auxiliary directions // About 0.01 degree turn difference between initial_primary and initial_auxiliary directions
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &initial_primary); bgc_fp32_vector3_make(&initial_primary, 1.0f, 0.0f, 0.0f);
bgc_vector3_set_values_fp32(1.0f, 0.000001f, 0.0f, &initial_auxiliary); bgc_fp32_vector3_make(&initial_auxiliary, 1.0f, 0.000001f, 0.0f);
bgc_vector3_set_values_fp32(0.0f, -1.0f, 0.0f, &final_primary); bgc_fp32_vector3_make(&final_primary, 0.0f, -1.0f, 0.0f);
bgc_vector3_set_values_fp32(1.0f, 0.0f, 0.0f, &final_auxiliary); bgc_fp32_vector3_make(&final_auxiliary, 1.0f, 0.0f, 0.0f);
bgc_versor_make_basis_difference_fp32(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp32_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nAbout 0.01 degree turn difference between initial_primary and initial_auxiliary directions:\n"); printf("\nAbout 0.01 degree turn difference between initial_primary and initial_auxiliary directions:\n");
print_versor_fp32(&turn); print_quaternion_fp32(&turn._versor);
} }
void test_basis_difference_fp64() void test_basis_difference_fp64()
{ {
BgcVector3FP64 initial_primary, initial_auxiliary; BGC_FP64_Vector3 initial_primary, initial_auxiliary;
BgcVector3FP64 final_primary, final_auxiliary; BGC_FP64_Vector3 final_primary, final_auxiliary;
BgcVersorFP64 turn; BGC_FP64_Turn3 turn;
// No turn // No turn
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, 0.0, 1.0, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nNo turn:\n"); printf("\nNo turn:\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// Turn around (1, 1, 0) axis on 180 degrees // Turn around (1, 1, 0) axis on 180 degrees
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, 1.0, 0.0, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nTurn around (1, 1, 0) axis on 180 degrees:\n"); printf("\nTurn around (1, 1, 0) axis on 180 degrees:\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// 180 degree turn // 180 degree turn
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(-1.0, 0.0, 0.0, &final_primary); bgc_fp64_vector3_make(&initial_auxiliary, -1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, 0.0, 1.0, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\n180 degree turn around (0, 1, 0):\n"); printf("\n180 degree turn around (0, 1, 0):\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// 90 degree turn around x3 axis // 90 degree turn around x3 axis
bgc_vector3_set_values_fp64(2.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 2.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 3.1, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.0, 3.1, 0.0);
bgc_vector3_set_values_fp64(0.0, 10.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 0.0, 10.0, 0.0);
bgc_vector3_set_values_fp64(-1.0, 0.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, -1.0, 0.0, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\n90 degree turn around (0, 0, 1):\n"); printf("\n90 degree turn around (0, 0, 1):\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// Unorthogonal pairs turn at 90 degrees around x3 axis // Unorthogonal pairs turn at 90 degrees around x3 axis
bgc_vector3_set_values_fp64(2.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 2.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(-2.0, 3.1, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, -2.0, 3.1, 0.0);
bgc_vector3_set_values_fp64(0.0, 10.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 0.0, 10.0, 0.0);
bgc_vector3_set_values_fp64(-1.0, 5.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, -1.0, 5.0, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nUnorthogonal pairs turn at 90 degrees around (0, 0, 1):\n"); printf("\nUnorthogonal pairs turn at 90 degrees around (0, 0, 1):\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// Zero vectors // Zero vectors
bgc_vector3_set_values_fp64(0.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 0.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, 0.0, 1.0, 0.0);
int code; int code;
code = bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); code = bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
if (code >= 0) { if (code >= 0) {
printf("\nZero vectors: this cannot be!\n"); printf("\nZero vectors: this cannot be!\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
} }
else { else {
printf("\nZero vector validation works fine\n"); printf("\nZero vector validation works fine\n");
} }
// Parallel vectors // Parallel vectors
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(2.0, 0.0, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 2.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, 0.0, 1.0, 0.0);
code = bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); code = bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
if (code >= 0) { if (code >= 0) {
printf("\nParallel vectors: this cannot be!\n"); printf("\nParallel vectors: this cannot be!\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
} }
else { else {
printf("\nParallelism validation works fine\n"); printf("\nParallelism validation works fine\n");
} }
// Small angle turn (about 1 degree): // Small angle turn (about 1 degree):
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(0.999848, 0.017452, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 0.999848, 0.017452, 0.0);
bgc_vector3_set_values_fp64(-0.017452, 0.999848, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, -0.017452, 0.999848, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nSmall angle turn (about 1 degree):\n"); printf("\nSmall angle turn (about 1 degree):\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// About 179 degrees turn // About 179 degrees turn
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(-0.999848, -0.017452, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, -0.999848, -0.017452, 0.0);
bgc_vector3_set_values_fp64(0.017452, -0.999848, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, 0.017452, -0.999848, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nAbout 179 degrees turn:\n"); printf("\nAbout 179 degrees turn:\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// 120 degrees around (-1, -1, 1) // 120 degrees around (-1, -1, 1)
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(0.0, 0.0, -1.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, 0.0, 0.0, -1.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\n120 degees turn:\n"); printf("\n120 degees turn:\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// About 1 degree turn difference between initial_primary and initial_auxiliary directions // About 1 degree turn difference between initial_primary and initial_auxiliary directions
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(0.999848, 0.017452, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 0.999848, 0.017452, 0.0);
bgc_vector3_set_values_fp64(0.0, 1.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 0.0, 1.0, 0.0);
bgc_vector3_set_values_fp64(-1.0, 0.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, -1.0, 0.0, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nAbout 1 degree turn difference between initial_primary and initial_auxiliary directions:\n"); printf("\nAbout 1 degree turn difference between initial_primary and initial_auxiliary directions:\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
// About 0.001 degree turn difference between initial_primary and initial_auxiliary directions // About 0.001 degree turn difference between initial_primary and initial_auxiliary directions
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &initial_primary); bgc_fp64_vector3_make(&initial_primary, 1.0, 0.0, 0.0);
bgc_vector3_set_values_fp64(1.0, 0.000001, 0.0, &initial_auxiliary); bgc_fp64_vector3_make(&initial_auxiliary, 1.0, 0.000001, 0.0);
bgc_vector3_set_values_fp64(0.0, -1.0, 0.0, &final_primary); bgc_fp64_vector3_make(&final_primary, 0.0, -1.0, 0.0);
bgc_vector3_set_values_fp64(1.0, 0.0, 0.0, &final_auxiliary); bgc_fp64_vector3_make(&final_auxiliary, 1.0, 0.0, 0.0);
bgc_versor_make_basis_difference_fp64(&initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary, &turn); bgc_fp64_turn3_make_basis_difference(&turn, &initial_primary, &initial_auxiliary, &final_primary, &final_auxiliary);
printf("\nAbout 0.01 degree turn difference between initial_primary and initial_auxiliary directions:\n"); printf("\nAbout 0.01 degree turn difference between initial_primary and initial_auxiliary directions:\n");
print_versor_fp64(&turn); print_quaternion_fp64(&turn._versor);
} }
/*
#include "affine3.h" #include "affine3.h"
int main() int main()
{ {
//BgcVersorFP32 start = { 1.0f, 0.0f, 0.0f, 0.0f }; //BGC_FP32_Turn3 start = { 1.0f, 0.0f, 0.0f, 0.0f };
//BgcVersorFP32 end = { 0.0f, 1.0f, 0.0f, 0.0f }; //BGC_FP32_Turn3 end = { 0.0f, 1.0f, 0.0f, 0.0f };
/*
BgcVersorFP32 start = { 1.0f, 0.0f, 0.0f, 0.0f };
BgcVersorFP32 end = { 0.9999f, 0.01414f, 0.0f, 0.0f };
BgcSlerpFP32 slerp;
BgcVersorFP32 result;
bgc_slerp_make_full_fp32(&start, &end, &slerp);
bgc_slerp_get_turn_for_phase_fp32(&slerp, 0.5f, &result);
print_versor_fp32(&result); BGC_FP32_Turn3 start = { 1.0f, 0.0f, 0.0f, 0.0f };
*/ BGC_FP32_Turn3 end = { 0.9999f, 0.01414f, 0.0f, 0.0f };
//test_basis_difference_fp64(); BGC_FP32_Slerp slerp;
BGC_FP32_Turn3 result;
bgc_fp32_slerp_make_full(&slerp, &start, &end);
bgc_fp32_slerp_get_phase_versor(&result, &slerp, 0.5f);
printf("Affine3 performance test: %f\n", test_bgc_affine3_performance(10000000, 10)); //print_quaternion_fp32(&result);
printf("sizeof(BgcAffine3FP32) = %zu\n", sizeof(BgcAffine3FP32)); test_basis_difference_fp64();
//printf("offsetof(shift) = %zu\n", offsetof(BgcAffine3FP32, shift));
printf("sizeof(BgcMatrix3x3FP32) = %zu\n", sizeof(BgcMatrix3x3FP32)); //printf("Affine3 performance test: %f\n", test_bgc_affine3_performance(10000000, 10));
//printf("sizeof(BGC_FP32_Affine3) = %zu\n", sizeof(BGC_FP32_Affine3));
//printf("offsetof(shift) = %zu\n", offsetof(BGC_FP32_Affine3, shift));
//printf("sizeof(BGC_FP32_Matrix3x3) = %zu\n", sizeof(BGC_FP32_Matrix3x3));
return 0; return 0;
} }
*/

View file

@ -51,186 +51,6 @@
</Unit> </Unit>
<Unit filename="main.h" /> <Unit filename="main.h" />
<Unit filename="test_utilities.h" /> <Unit filename="test_utilities.h" />
<Unit filename="tests/complex.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex.h" />
<Unit filename="tests/complex/complex_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_copy.h" />
<Unit filename="tests/complex/complex_is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_is_unit.h" />
<Unit filename="tests/complex/complex_is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_is_zero.h" />
<Unit filename="tests/complex/complex_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_modulus.h" />
<Unit filename="tests/complex/complex_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_reset.h" />
<Unit filename="tests/complex/complex_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_set_values.h" />
<Unit filename="tests/complex/complex_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_swap.h" />
<Unit filename="tests/quaternion.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion.h" />
<Unit filename="tests/quaternion/quaternion_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_copy.h" />
<Unit filename="tests/quaternion/quaternion_is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_is_unit.h" />
<Unit filename="tests/quaternion/quaternion_is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_is_zero.h" />
<Unit filename="tests/quaternion/quaternion_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_modulus.h" />
<Unit filename="tests/quaternion/quaternion_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_reset.h" />
<Unit filename="tests/quaternion/quaternion_set_to_identity.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_set_to_identity.h" />
<Unit filename="tests/quaternion/quaternion_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_set_values.h" />
<Unit filename="tests/quaternion/quaternion_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_swap.h" />
<Unit filename="tests/utilities.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/utilities.h" />
<Unit filename="tests/utilities/are_close.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/utilities/are_close.h" />
<Unit filename="tests/utilities/is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/utilities/is_unit.h" />
<Unit filename="tests/utilities/is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/utilities/is_zero.h" />
<Unit filename="tests/vector2.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2.h" />
<Unit filename="tests/vector2/vector2_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_copy.h" />
<Unit filename="tests/vector2/vector2_is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_is_unit.h" />
<Unit filename="tests/vector2/vector2_is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_is_zero.h" />
<Unit filename="tests/vector2/vector2_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_modulus.h" />
<Unit filename="tests/vector2/vector2_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_reset.h" />
<Unit filename="tests/vector2/vector2_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_set_values.h" />
<Unit filename="tests/vector2/vector2_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_swap.h" />
<Unit filename="tests/vector3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3.h" />
<Unit filename="tests/vector3/vector3_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_copy.h" />
<Unit filename="tests/vector3/vector3_is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_is_unit.h" />
<Unit filename="tests/vector3/vector3_is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_is_zero.h" />
<Unit filename="tests/vector3/vector3_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_modulus.h" />
<Unit filename="tests/vector3/vector3_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_reset.h" />
<Unit filename="tests/vector3/vector3_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_set_values.h" />
<Unit filename="tests/vector3/vector3_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_swap.h" />
<Unit filename="tests/versor.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor.h" />
<Unit filename="tests/versor/versor_are_close.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_are_close.h" />
<Unit filename="tests/versor/versor_combine.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_combine.h" />
<Unit filename="tests/versor/versor_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_copy.h" />
<Unit filename="tests/versor/versor_is_identity.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_is_identity.h" />
<Unit filename="tests/versor/versor_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_reset.h" />
<Unit filename="tests/versor/versor_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_set_values.h" />
<Unit filename="tests/versor/versor_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_swap.h" />
<Unit filename="unity/unity.c"> <Unit filename="unity/unity.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>

View file

@ -150,105 +150,9 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="helpers.c" /> <ClCompile Include="helpers.c" />
<ClCompile Include="main.c" /> <ClCompile Include="main.c" />
<ClCompile Include="tests\complex.c" />
<ClCompile Include="tests\complex\complex_copy.c" />
<ClCompile Include="tests\complex\complex_is_unit.c" />
<ClCompile Include="tests\complex\complex_is_zero.c" />
<ClCompile Include="tests\complex\complex_modulus.c" />
<ClCompile Include="tests\complex\complex_reset.c" />
<ClCompile Include="tests\complex\complex_set_values.c" />
<ClCompile Include="tests\complex\complex_swap.c" />
<ClCompile Include="tests\complex\complex_arithmetics.c" />
<ClCompile Include="tests\quaternion.c" />
<ClCompile Include="tests\quaternion\quaternion_copy.c" />
<ClCompile Include="tests\quaternion\quaternion_is_unit.c" />
<ClCompile Include="tests\quaternion\quaternion_is_zero.c" />
<ClCompile Include="tests\quaternion\quaternion_modulus.c" />
<ClCompile Include="tests\quaternion\quaternion_reset.c" />
<ClCompile Include="tests\quaternion\quaternion_set_to_identity.c" />
<ClCompile Include="tests\quaternion\quaternion_set_values.c" />
<ClCompile Include="tests\quaternion\quaternion_swap.c" />
<ClCompile Include="tests\utilities.c" />
<ClCompile Include="tests\utilities\are_close.c" />
<ClCompile Include="tests\utilities\is_unit.c" />
<ClCompile Include="tests\utilities\is_zero.c" />
<ClCompile Include="tests\vector2.c" />
<ClCompile Include="tests\vector2\vector2_arithmetics.c" />
<ClCompile Include="tests\vector2\vector2_is_unit.c" />
<ClCompile Include="tests\vector2\vector2_is_zero.c" />
<ClCompile Include="tests\vector2\vector2_copy.c" />
<ClCompile Include="tests\vector2\vector2_modulus.c" />
<ClCompile Include="tests\vector2\vector2_reset.c" />
<ClCompile Include="tests\vector2\vector2_set_values.c" />
<ClCompile Include="tests\vector2\vector2_swap.c" />
<ClCompile Include="tests\vector3.c" />
<ClCompile Include="tests\vector3\vector3_arithmetics.c" />
<ClCompile Include="tests\vector3\vector3_is_unit.c" />
<ClCompile Include="tests\vector3\vector3_is_zero.c" />
<ClCompile Include="tests\vector3\vector3_copy.c" />
<ClCompile Include="tests\vector3\vector3_modulus.c" />
<ClCompile Include="tests\vector3\vector3_swap.c" />
<ClCompile Include="tests\vector3\vector3_reset.c" />
<ClCompile Include="tests\vector3\vector3_set_values.c" />
<ClCompile Include="tests\versor.c" />
<ClCompile Include="tests\versor\versor_copy.c" />
<ClCompile Include="tests\versor\versor_is_identity.c" />
<ClCompile Include="tests\versor\versor_swap.c" />
<ClCompile Include="tests\versor\versor_combine.c" />
<ClCompile Include="tests\versor\versor_reset.c" />
<ClCompile Include="tests\versor\versor_set_values.c" />
<ClCompile Include="tests\versor\versor_are_close.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="helpers.h" /> <ClInclude Include="helpers.h" />
<ClInclude Include="tests\complex.h" />
<ClInclude Include="tests\complex\complex_copy.h" />
<ClInclude Include="tests\complex\complex_is_unit.h" />
<ClInclude Include="tests\complex\complex_is_zero.h" />
<ClInclude Include="tests\complex\complex_modulus.h" />
<ClInclude Include="tests\complex\complex_reset.h" />
<ClInclude Include="tests\complex\complex_set_values.h" />
<ClInclude Include="tests\complex\complex_swap.h" />
<ClInclude Include="tests\complex\complex_arithmetics.h" />
<ClInclude Include="tests\quaternion.h" />
<ClInclude Include="tests\quaternion\quaternion_copy.h" />
<ClInclude Include="tests\quaternion\quaternion_is_unit.h" />
<ClInclude Include="tests\quaternion\quaternion_is_zero.h" />
<ClInclude Include="tests\quaternion\quaternion_modulus.h" />
<ClInclude Include="tests\quaternion\quaternion_reset.h" />
<ClInclude Include="tests\quaternion\quaternion_set_to_identity.h" />
<ClInclude Include="tests\quaternion\quaternion_set_values.h" />
<ClInclude Include="tests\quaternion\quaternion_swap.h" />
<ClInclude Include="tests\utilities.h" />
<ClInclude Include="tests\utilities\are_close.h" />
<ClInclude Include="tests\utilities\is_unit.h" />
<ClInclude Include="tests\utilities\is_zero.h" />
<ClInclude Include="tests\vector2.h" />
<ClInclude Include="tests\vector2\vector2_arithmetics.h" />
<ClInclude Include="tests\vector2\vector2_is_unit.h" />
<ClInclude Include="tests\vector2\vector2_is_zero.h" />
<ClInclude Include="tests\vector2\vector2_copy.h" />
<ClInclude Include="tests\vector2\vector2_modulus.h" />
<ClInclude Include="tests\vector2\vector2_reset.h" />
<ClInclude Include="tests\vector2\vector2_set_values.h" />
<ClInclude Include="tests\vector2\vector2_swap.h" />
<ClInclude Include="tests\vector3.h" />
<ClInclude Include="tests\vector3\vector3_arithmetics.h" />
<ClInclude Include="tests\vector3\vector3_is_unit.h" />
<ClInclude Include="tests\vector3\vector3_is_zero.h" />
<ClInclude Include="tests\vector3\vector3_copy.h" />
<ClInclude Include="tests\vector3\vector3_modulus.h" />
<ClInclude Include="tests\vector3\vector3_swap.h" />
<ClInclude Include="tests\vector3\vector3_reset.h" />
<ClInclude Include="tests\vector3\vector3_set_values.h" />
<ClInclude Include="tests\versor.h" />
<ClInclude Include="tests\versor\versor_copy.h" />
<ClInclude Include="tests\versor\versor_is_identity.h" />
<ClInclude Include="tests\versor\versor_swap.h" />
<ClInclude Include="tests\versor\versor_combine.h" />
<ClInclude Include="tests\versor\versor_reset.h" />
<ClInclude Include="tests\versor\versor_set_values.h" />
<ClInclude Include="tests\versor\versor_are_close.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View file

@ -3,319 +3,8 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="main.c" /> <ClCompile Include="main.c" />
<ClCompile Include="helpers.c" /> <ClCompile Include="helpers.c" />
<ClCompile Include="tests\utilities.c">
<Filter>tests</Filter>
</ClCompile>
<ClCompile Include="tests\vector2.c">
<Filter>tests</Filter>
</ClCompile>
<ClCompile Include="tests\vector3.c">
<Filter>tests</Filter>
</ClCompile>
<ClCompile Include="tests\versor.c">
<Filter>tests</Filter>
</ClCompile>
<ClCompile Include="tests\utilities\is_zero.c">
<Filter>tests\utilities</Filter>
</ClCompile>
<ClCompile Include="tests\utilities\is_unit.c">
<Filter>tests\utilities</Filter>
</ClCompile>
<ClCompile Include="tests\utilities\are_close.c">
<Filter>tests\utilities</Filter>
</ClCompile>
<ClCompile Include="tests\versor\versor_are_close.c">
<Filter>tests\versor</Filter>
</ClCompile>
<ClCompile Include="tests\versor\versor_set_values.c">
<Filter>tests\versor</Filter>
</ClCompile>
<ClCompile Include="tests\versor\versor_combine.c">
<Filter>tests\versor</Filter>
</ClCompile>
<ClCompile Include="tests\versor\versor_reset.c">
<Filter>tests\versor</Filter>
</ClCompile>
<ClCompile Include="tests\vector2\vector2_reset.c">
<Filter>tests\vector2</Filter>
</ClCompile>
<ClCompile Include="tests\vector2\vector2_set_values.c">
<Filter>tests\vector2</Filter>
</ClCompile>
<ClCompile Include="tests\vector3\vector3_reset.c">
<Filter>tests\vector3</Filter>
</ClCompile>
<ClCompile Include="tests\vector3\vector3_set_values.c">
<Filter>tests\vector3</Filter>
</ClCompile>
<ClCompile Include="tests\vector2\vector2_copy.c">
<Filter>tests\vector2</Filter>
</ClCompile>
<ClCompile Include="tests\vector2\vector2_swap.c">
<Filter>tests\vector2</Filter>
</ClCompile>
<ClCompile Include="tests\vector3\vector3_copy.c">
<Filter>tests\vector3</Filter>
</ClCompile>
<ClCompile Include="tests\vector3\vector3_swap.c">
<Filter>tests\vector3</Filter>
</ClCompile>
<ClCompile Include="tests\versor\versor_copy.c">
<Filter>tests\versor</Filter>
</ClCompile>
<ClCompile Include="tests\versor\versor_swap.c">
<Filter>tests\versor</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion\quaternion_copy.c">
<Filter>tests\quaternion</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion\quaternion_reset.c">
<Filter>tests\quaternion</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion\quaternion_set_values.c">
<Filter>tests\quaternion</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion\quaternion_swap.c">
<Filter>tests\quaternion</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion.c">
<Filter>tests</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion\quaternion_set_to_identity.c">
<Filter>tests\quaternion</Filter>
</ClCompile>
<ClCompile Include="tests\vector3\vector3_is_zero.c">
<Filter>tests\vector3</Filter>
</ClCompile>
<ClCompile Include="tests\vector2\vector2_is_zero.c">
<Filter>tests\vector2</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion\quaternion_is_zero.c">
<Filter>tests\quaternion</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion\quaternion_is_unit.c">
<Filter>tests\quaternion</Filter>
</ClCompile>
<ClCompile Include="tests\vector3\vector3_is_unit.c">
<Filter>tests\vector3</Filter>
</ClCompile>
<ClCompile Include="tests\vector2\vector2_is_unit.c">
<Filter>tests\vector2</Filter>
</ClCompile>
<ClCompile Include="tests\versor\versor_is_identity.c">
<Filter>tests\versor</Filter>
</ClCompile>
<ClCompile Include="tests\vector2\vector2_modulus.c">
<Filter>tests\vector2</Filter>
</ClCompile>
<ClCompile Include="tests\vector3\vector3_modulus.c">
<Filter>tests\vector3</Filter>
</ClCompile>
<ClCompile Include="tests\quaternion\quaternion_modulus.c">
<Filter>tests\quaternion</Filter>
</ClCompile>
<ClCompile Include="tests\complex\complex_copy.c">
<Filter>tests\complex</Filter>
</ClCompile>
<ClCompile Include="tests\complex\complex_is_unit.c">
<Filter>tests\complex</Filter>
</ClCompile>
<ClCompile Include="tests\complex\complex_is_zero.c">
<Filter>tests\complex</Filter>
</ClCompile>
<ClCompile Include="tests\complex\complex_modulus.c">
<Filter>tests\complex</Filter>
</ClCompile>
<ClCompile Include="tests\complex\complex_reset.c">
<Filter>tests\complex</Filter>
</ClCompile>
<ClCompile Include="tests\complex\complex_set_values.c">
<Filter>tests\complex</Filter>
</ClCompile>
<ClCompile Include="tests\complex\complex_swap.c">
<Filter>tests\complex</Filter>
</ClCompile>
<ClCompile Include="tests\complex.c">
<Filter>tests</Filter>
</ClCompile>
<ClCompile Include="tests\vector2\vector2_arithmetics.c">
<Filter>tests\vector2</Filter>
</ClCompile>
<ClCompile Include="tests\vector3\vector3_arithmetics.c">
<Filter>tests\vector3</Filter>
</ClCompile>
<ClCompile Include="tests\complex\complex_arithmetics.c">
<Filter>tests\complex</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="helpers.h" /> <ClInclude Include="helpers.h" />
<ClInclude Include="tests\utilities.h">
<Filter>tests</Filter>
</ClInclude>
<ClInclude Include="tests\vector2.h">
<Filter>tests</Filter>
</ClInclude>
<ClInclude Include="tests\vector3.h">
<Filter>tests</Filter>
</ClInclude>
<ClInclude Include="tests\versor.h">
<Filter>tests</Filter>
</ClInclude>
<ClInclude Include="tests\utilities\is_zero.h">
<Filter>tests\utilities</Filter>
</ClInclude>
<ClInclude Include="tests\utilities\is_unit.h">
<Filter>tests\utilities</Filter>
</ClInclude>
<ClInclude Include="tests\utilities\are_close.h">
<Filter>tests\utilities</Filter>
</ClInclude>
<ClInclude Include="tests\versor\versor_are_close.h">
<Filter>tests\versor</Filter>
</ClInclude>
<ClInclude Include="tests\versor\versor_set_values.h">
<Filter>tests\versor</Filter>
</ClInclude>
<ClInclude Include="tests\versor\versor_combine.h">
<Filter>tests\versor</Filter>
</ClInclude>
<ClInclude Include="tests\versor\versor_reset.h">
<Filter>tests\versor</Filter>
</ClInclude>
<ClInclude Include="tests\vector2\vector2_reset.h">
<Filter>tests\vector2</Filter>
</ClInclude>
<ClInclude Include="tests\vector2\vector2_set_values.h">
<Filter>tests\vector2</Filter>
</ClInclude>
<ClInclude Include="tests\vector3\vector3_reset.h">
<Filter>tests\vector3</Filter>
</ClInclude>
<ClInclude Include="tests\vector3\vector3_set_values.h">
<Filter>tests\vector3</Filter>
</ClInclude>
<ClInclude Include="tests\vector2\vector2_copy.h">
<Filter>tests\vector2</Filter>
</ClInclude>
<ClInclude Include="tests\vector2\vector2_swap.h">
<Filter>tests\vector2</Filter>
</ClInclude>
<ClInclude Include="tests\vector3\vector3_copy.h">
<Filter>tests\vector3</Filter>
</ClInclude>
<ClInclude Include="tests\vector3\vector3_swap.h">
<Filter>tests\vector3</Filter>
</ClInclude>
<ClInclude Include="tests\versor\versor_copy.h">
<Filter>tests\versor</Filter>
</ClInclude>
<ClInclude Include="tests\versor\versor_swap.h">
<Filter>tests\versor</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion\quaternion_copy.h">
<Filter>tests\quaternion</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion\quaternion_reset.h">
<Filter>tests\quaternion</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion\quaternion_set_values.h">
<Filter>tests\quaternion</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion\quaternion_swap.h">
<Filter>tests\quaternion</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion.h">
<Filter>tests</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion\quaternion_set_to_identity.h">
<Filter>tests\quaternion</Filter>
</ClInclude>
<ClInclude Include="tests\vector3\vector3_is_zero.h">
<Filter>tests\vector3</Filter>
</ClInclude>
<ClInclude Include="tests\vector2\vector2_is_zero.h">
<Filter>tests\vector2</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion\quaternion_is_zero.h">
<Filter>tests\quaternion</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion\quaternion_is_unit.h">
<Filter>tests\quaternion</Filter>
</ClInclude>
<ClInclude Include="tests\vector3\vector3_is_unit.h">
<Filter>tests\vector3</Filter>
</ClInclude>
<ClInclude Include="tests\vector2\vector2_is_unit.h">
<Filter>tests\vector2</Filter>
</ClInclude>
<ClInclude Include="tests\versor\versor_is_identity.h">
<Filter>tests\versor</Filter>
</ClInclude>
<ClInclude Include="tests\vector2\vector2_modulus.h">
<Filter>tests\vector2</Filter>
</ClInclude>
<ClInclude Include="tests\vector3\vector3_modulus.h">
<Filter>tests\vector3</Filter>
</ClInclude>
<ClInclude Include="tests\quaternion\quaternion_modulus.h">
<Filter>tests\quaternion</Filter>
</ClInclude>
<ClInclude Include="tests\complex\complex_copy.h">
<Filter>tests\complex</Filter>
</ClInclude>
<ClInclude Include="tests\complex\complex_is_unit.h">
<Filter>tests\complex</Filter>
</ClInclude>
<ClInclude Include="tests\complex\complex_is_zero.h">
<Filter>tests\complex</Filter>
</ClInclude>
<ClInclude Include="tests\complex\complex_modulus.h">
<Filter>tests\complex</Filter>
</ClInclude>
<ClInclude Include="tests\complex\complex_reset.h">
<Filter>tests\complex</Filter>
</ClInclude>
<ClInclude Include="tests\complex\complex_set_values.h">
<Filter>tests\complex</Filter>
</ClInclude>
<ClInclude Include="tests\complex\complex_swap.h">
<Filter>tests\complex</Filter>
</ClInclude>
<ClInclude Include="tests\complex.h">
<Filter>tests</Filter>
</ClInclude>
<ClInclude Include="tests\vector2\vector2_arithmetics.h">
<Filter>tests\vector2</Filter>
</ClInclude>
<ClInclude Include="tests\vector3\vector3_arithmetics.h">
<Filter>tests\vector3</Filter>
</ClInclude>
<ClInclude Include="tests\complex\complex_arithmetics.h">
<Filter>tests\complex</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="tests">
<UniqueIdentifier>{10db9024-67b8-4555-80a9-48b54ae0dec9}</UniqueIdentifier>
</Filter>
<Filter Include="tests\utilities">
<UniqueIdentifier>{392bc542-f334-4132-a22b-b5b440c77897}</UniqueIdentifier>
</Filter>
<Filter Include="tests\vector2">
<UniqueIdentifier>{d9f520e0-1b2d-4379-8887-1b5728763129}</UniqueIdentifier>
</Filter>
<Filter Include="tests\vector3">
<UniqueIdentifier>{dbf2eefa-8f1f-4447-b3d4-d17dee049580}</UniqueIdentifier>
</Filter>
<Filter Include="tests\versor">
<UniqueIdentifier>{d6f82407-8310-4b32-b153-aa67e766c72a}</UniqueIdentifier>
</Filter>
<Filter Include="tests\quaternion">
<UniqueIdentifier>{e8bafdb8-66e5-4393-bc89-8bff83bcccd6}</UniqueIdentifier>
</Filter>
<Filter Include="tests\complex">
<UniqueIdentifier>{e025e123-45aa-44f9-aab4-f1705844b211}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -25,19 +25,19 @@ typedef struct {
// =================== Versor =================== // // =================== Versor =================== //
typedef struct { typedef struct {
BgcVersorFP32 first, second; BGC_FP32_Turn3 first, second;
} TestVersorPairFP32; } TestVersorPairFP32;
typedef struct { typedef struct {
BgcVersorFP64 first, second; BGC_FP64_Turn3 first, second;
} TestVersorPairFP64; } TestVersorPairFP64;
typedef struct { typedef struct {
BgcVersorFP32 first, second, result; BGC_FP32_Turn3 first, second, result;
} TestVersorTripletFP32; } TestVersorTripletFP32;
typedef struct { typedef struct {
BgcVersorFP64 first, second, result; BGC_FP64_Turn3 first, second, result;
} TestVersorTripletFP64; } TestVersorTripletFP64;
// ================= Functions ================== // // ================= Functions ================== //

View file

@ -7,7 +7,7 @@
// ==================== FP32 ==================== // // ==================== FP32 ==================== //
static const int _TEST_FP32_COMPLEX_AMOUNT = 4; static const int _TEST_FP32_COMPLEX_AMOUNT = 4;
static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST[] = { static const BGC_FP32_Complex _TEST_FP32_COMPLEX_LIST[] = {
{ 1.0f, 2.0f }, { 1.0f, 2.0f },
{ -4.0f, -3.0f }, { -4.0f, -3.0f },
{ -0.001f, 100.0f }, { -0.001f, 100.0f },
@ -16,13 +16,13 @@ static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST[] = {
void test_complex_copy_fp32() void test_complex_copy_fp32()
{ {
BgcComplexFP32 vector; BGC_FP32_Complex vector;
print_testing_name("bgc_complex_copy_fp32"); print_testing_name("bgc_fp32_complex_copy");
for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) {
bgc_complex_copy_fp32(&_TEST_FP32_COMPLEX_LIST[i], &vector); bgc_fp32_complex_copy(&_TEST_FP32_COMPLEX_LIST[i], &vector);
if (vector.real != _TEST_FP32_COMPLEX_LIST[i].real || if (vector.real != _TEST_FP32_COMPLEX_LIST[i].real ||
vector.imaginary != _TEST_FP32_COMPLEX_LIST[i].imaginary) { vector.imaginary != _TEST_FP32_COMPLEX_LIST[i].imaginary) {
@ -37,7 +37,7 @@ void test_complex_copy_fp32()
// ==================== FP64 ==================== // // ==================== FP64 ==================== //
static const int _TEST_FP64_COMPLEX_AMOUNT = 4; static const int _TEST_FP64_COMPLEX_AMOUNT = 4;
static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST[] = { static const BGC_FP64_Complex _TEST_FP64_COMPLEX_LIST[] = {
{ 1.0, 2.0 }, { 1.0, 2.0 },
{ -4.0, -3.0 }, { -4.0, -3.0 },
{ -0.001, 100.0 }, { -0.001, 100.0 },
@ -46,13 +46,13 @@ static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST[] = {
void test_complex_copy_fp64() void test_complex_copy_fp64()
{ {
BgcComplexFP64 vector; BGC_FP64_Complex vector;
print_testing_name("bgc_complex_copy_fp64"); print_testing_name("bgc_fp64_complex_copy");
for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) {
bgc_complex_copy_fp64(&_TEST_FP64_COMPLEX_LIST[i], &vector); bgc_fp64_complex_copy(&_TEST_FP64_COMPLEX_LIST[i], &vector);
if (vector.real != _TEST_FP64_COMPLEX_LIST[i].real || if (vector.real != _TEST_FP64_COMPLEX_LIST[i].real ||
vector.imaginary != _TEST_FP64_COMPLEX_LIST[i].imaginary) { vector.imaginary != _TEST_FP64_COMPLEX_LIST[i].imaginary) {

View file

@ -7,35 +7,35 @@
static const int _TEST_FP32_UNIT_COMPLEX_AMOUNT = 10; static const int _TEST_FP32_UNIT_COMPLEX_AMOUNT = 10;
static const int _TEST_FP32_NONUNIT_COMPLEX_AMOUNT = 6; static const int _TEST_FP32_NONUNIT_COMPLEX_AMOUNT = 6;
static const BgcComplexFP32 _TEST_FP32_UNIT_COMPLEX_LIST[] = { static const BGC_FP32_Complex _TEST_FP32_UNIT_COMPLEX_LIST[] = {
{ 1.0f, 0.0f }, { 1.0f, 0.0f },
{ -1.0f, 0.0f }, { -1.0f, 0.0f },
{ 0.6f, -0.8f }, { 0.6f, -0.8f },
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON },
{ 0.7071067812f, 0.7071067812f }, { 0.7071067812f, 0.7071067812f },
{ 0.7071067812f + 0.75f * BGC_EPSYLON_FP32, 0.7071067812f }, { 0.7071067812f + 0.75f * BGC_FP32_EPSYLON, 0.7071067812f },
{ 0.7071067812f, 0.7071067812f - 0.75f * BGC_EPSYLON_FP32 } { 0.7071067812f, 0.7071067812f - 0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcComplexFP32 _TEST_FP32_NONUNIT_QUATERION_LIST[] = { static const BGC_FP32_Complex _TEST_FP32_NONUNIT_QUATERION_LIST[] = {
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON },
{ 0.7071067812f + 1.25f * BGC_EPSYLON_FP32, 0.7071067812f + 1.25f * BGC_EPSYLON_FP32 }, { 0.7071067812f + 1.25f * BGC_FP32_EPSYLON, 0.7071067812f + 1.25f * BGC_FP32_EPSYLON },
{ 0.7071067812f - 1.25f * BGC_EPSYLON_FP32, 0.7071067812f - 1.25f * BGC_EPSYLON_FP32 } { 0.7071067812f - 1.25f * BGC_FP32_EPSYLON, 0.7071067812f - 1.25f * BGC_FP32_EPSYLON }
}; };
void test_complex_is_unit_fp32() void test_complex_is_unit_fp32()
{ {
print_testing_name("bgc_complex_is_unit_fp32"); print_testing_name("bgc_fp32_complex_is_unit");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_UNIT_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_UNIT_COMPLEX_AMOUNT; i++) {
if (!bgc_complex_is_unit_fp32(&_TEST_FP32_UNIT_COMPLEX_LIST[i])) { if (!bgc_fp32_complex_is_unit(&_TEST_FP32_UNIT_COMPLEX_LIST[i])) {
print_testing_error("A unit complex number was not recognized"); print_testing_error("A unit complex number was not recognized");
return; return;
} }
@ -43,7 +43,7 @@ void test_complex_is_unit_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONUNIT_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONUNIT_COMPLEX_AMOUNT; i++) {
if (bgc_complex_is_unit_fp32(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) { if (bgc_fp32_complex_is_unit(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) {
print_testing_error("A non-unit complex number was recognized a unit complex number"); print_testing_error("A non-unit complex number was recognized a unit complex number");
return; return;
} }
@ -57,35 +57,35 @@ void test_complex_is_unit_fp32()
static const int _TEST_FP64_UNIT_COMPLEX_AMOUNT = 10; static const int _TEST_FP64_UNIT_COMPLEX_AMOUNT = 10;
static const int _TEST_FP64_NONUNIT_COMPLEX_AMOUNT = 6; static const int _TEST_FP64_NONUNIT_COMPLEX_AMOUNT = 6;
static const BgcComplexFP64 _TEST_FP64_UNIT_COMPLEX_LIST[] = { static const BGC_FP64_Complex _TEST_FP64_UNIT_COMPLEX_LIST[] = {
{ 1.0, 0.0 }, { 1.0, 0.0 },
{ -1.0, 0.0 }, { -1.0, 0.0 },
{ -0.6, 0.8 }, { -0.6, 0.8 },
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON },
{ 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON },
{ 0.7071067811865475244, 0.7071067811865475244 }, { 0.7071067811865475244, 0.7071067811865475244 },
{ 0.7071067811865475244 + 0.75 * BGC_EPSYLON_FP64, 0.7071067811865475244 }, { 0.7071067811865475244 + 0.75 * BGC_FP64_EPSYLON, 0.7071067811865475244 },
{ 0.7071067811865475244, 0.7071067811865475244 - 0.75 * BGC_EPSYLON_FP64 } { 0.7071067811865475244, 0.7071067811865475244 - 0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcComplexFP64 _TEST_FP64_NONUNIT_QUATERION_LIST[] = { static const BGC_FP64_Complex _TEST_FP64_NONUNIT_QUATERION_LIST[] = {
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON },
{ 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON },
{ 0.7071067811865475244 + 1.25 * BGC_EPSYLON_FP64, 0.7071067811865475244 + 1.25 * BGC_EPSYLON_FP64 }, { 0.7071067811865475244 + 1.25 * BGC_FP64_EPSYLON, 0.7071067811865475244 + 1.25 * BGC_FP64_EPSYLON },
{ 0.7071067811865475244 - 1.25 * BGC_EPSYLON_FP64, 0.7071067811865475244 - 1.25 * BGC_EPSYLON_FP64 } { 0.7071067811865475244 - 1.25 * BGC_FP64_EPSYLON, 0.7071067811865475244 - 1.25 * BGC_FP64_EPSYLON }
}; };
void test_complex_is_unit_fp64() void test_complex_is_unit_fp64()
{ {
print_testing_name("bgc_complex_is_unit_fp64"); print_testing_name("bgc_fp64_complex_is_unit");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_UNIT_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_UNIT_COMPLEX_AMOUNT; i++) {
if (!bgc_complex_is_unit_fp64(&_TEST_FP64_UNIT_COMPLEX_LIST[i])) { if (!bgc_fp64_complex_is_unit(&_TEST_FP64_UNIT_COMPLEX_LIST[i])) {
print_testing_error("A unit complex number was not recognized"); print_testing_error("A unit complex number was not recognized");
return; return;
} }
@ -93,7 +93,7 @@ void test_complex_is_unit_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONUNIT_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONUNIT_COMPLEX_AMOUNT; i++) {
if (bgc_complex_is_unit_fp64(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) { if (bgc_fp64_complex_is_unit(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) {
print_testing_error("A non-unit complex number was recognized a unit complex number"); print_testing_error("A non-unit complex number was recognized a unit complex number");
return; return;
} }

View file

@ -7,31 +7,31 @@
static const int _TEST_FP32_ZERO_COMPLEX_AMOUNT = 4; static const int _TEST_FP32_ZERO_COMPLEX_AMOUNT = 4;
static const int _TEST_FP32_NONZERO_COMPLEX_AMOUNT = 7; static const int _TEST_FP32_NONZERO_COMPLEX_AMOUNT = 7;
static const BgcComplexFP32 _TEST_FP32_ZERO_COMPLEX_LIST[] = { static const BGC_FP32_Complex _TEST_FP32_ZERO_COMPLEX_LIST[] = {
{ 0.0f, 0.0f }, { 0.0f, 0.0f },
{ 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ -0.75f * BGC_EPSYLON_FP32, 0.0f }, { -0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, -0.75f * BGC_EPSYLON_FP32 } { 0.0f, -0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcComplexFP32 _TEST_FP32_NONZERO_QUATERION_LIST[] = { static const BGC_FP32_Complex _TEST_FP32_NONZERO_QUATERION_LIST[] = {
{ 0.0f, 1.0f }, { 0.0f, 1.0f },
{ 1.25f * BGC_EPSYLON_FP32 }, { 1.25f * BGC_FP32_EPSYLON },
{ -1.25f * BGC_EPSYLON_FP32 }, { -1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, -1.25f * BGC_EPSYLON_FP32 }, { 0.0f, -1.25f * BGC_FP32_EPSYLON },
{ 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32 }, { 1.25f * BGC_FP32_EPSYLON, 1.25f * BGC_FP32_EPSYLON },
{ -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32 } { -1.25f * BGC_FP32_EPSYLON, -1.25f * BGC_FP32_EPSYLON }
}; };
void test_complex_is_zero_fp32() void test_complex_is_zero_fp32()
{ {
print_testing_name("bgc_complex_is_zero_fp32"); print_testing_name("bgc_fp32_complex_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_ZERO_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_ZERO_COMPLEX_AMOUNT; i++) {
if (!bgc_complex_is_zero_fp32(&_TEST_FP32_ZERO_COMPLEX_LIST[i])) { if (!bgc_fp32_complex_is_zero(&_TEST_FP32_ZERO_COMPLEX_LIST[i])) {
print_testing_error("A zero complex number was not recognized"); print_testing_error("A zero complex number was not recognized");
return; return;
} }
@ -39,7 +39,7 @@ void test_complex_is_zero_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONZERO_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONZERO_COMPLEX_AMOUNT; i++) {
if (bgc_complex_is_zero_fp32(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) { if (bgc_fp32_complex_is_zero(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) {
print_testing_error("A non-zero complex number was recognized as a zero complex number"); print_testing_error("A non-zero complex number was recognized as a zero complex number");
return; return;
} }
@ -53,31 +53,31 @@ void test_complex_is_zero_fp32()
static const int _TEST_FP64_ZERO_COMPLEX_AMOUNT = 4; static const int _TEST_FP64_ZERO_COMPLEX_AMOUNT = 4;
static const int _TEST_FP64_NONZERO_COMPLEX_AMOUNT = 7; static const int _TEST_FP64_NONZERO_COMPLEX_AMOUNT = 7;
static const BgcComplexFP64 _TEST_FP64_ZERO_COMPLEX_LIST[] = { static const BGC_FP64_Complex _TEST_FP64_ZERO_COMPLEX_LIST[] = {
{ 0.0, 0.0 }, { 0.0, 0.0 },
{ 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ -0.75 * BGC_EPSYLON_FP64, 0.0 }, { -0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 0.75 * BGC_FP64_EPSYLON },
{ 0.0, -0.75 * BGC_EPSYLON_FP64 } { 0.0, -0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcComplexFP64 _TEST_FP64_NONZERO_QUATERION_LIST[] = { static const BGC_FP64_Complex _TEST_FP64_NONZERO_QUATERION_LIST[] = {
{ 0.0, 1.0 }, { 0.0, 1.0 },
{ 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ -1.25 * BGC_EPSYLON_FP64, 0.0 }, { -1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 1.25 * BGC_FP64_EPSYLON },
{ 0.0, -1.25 * BGC_EPSYLON_FP64 }, { 0.0, -1.25 * BGC_FP64_EPSYLON },
{ 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64 }, { 1.25 * BGC_FP64_EPSYLON, 1.25 * BGC_FP64_EPSYLON },
{ -1.25 * BGC_EPSYLON_FP64, -1.25 * BGC_EPSYLON_FP64 } { -1.25 * BGC_FP64_EPSYLON, -1.25 * BGC_FP64_EPSYLON }
}; };
void test_complex_is_zero_fp64() void test_complex_is_zero_fp64()
{ {
print_testing_name("bgc_complex_is_zero_fp64"); print_testing_name("bgc_fp64_complex_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_ZERO_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_ZERO_COMPLEX_AMOUNT; i++) {
if (!bgc_complex_is_zero_fp64(&_TEST_FP64_ZERO_COMPLEX_LIST[i])) { if (!bgc_fp64_complex_is_zero(&_TEST_FP64_ZERO_COMPLEX_LIST[i])) {
print_testing_error("A zero complex number was not recognized"); print_testing_error("A zero complex number was not recognized");
return; return;
} }
@ -85,7 +85,7 @@ void test_complex_is_zero_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONZERO_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONZERO_COMPLEX_AMOUNT; i++) {
if (bgc_complex_is_zero_fp64(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) { if (bgc_fp64_complex_is_zero(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) {
print_testing_error("A non-zero complex number was recognized as a zero complex number"); print_testing_error("A non-zero complex number was recognized as a zero complex number");
return; return;
} }

View file

@ -6,7 +6,7 @@
static const int _TEST_FP32_COMPLEX_AMOUNT = 4; static const int _TEST_FP32_COMPLEX_AMOUNT = 4;
static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST[] = { static const BGC_FP32_Complex _TEST_FP32_COMPLEX_LIST[] = {
{ 4.0f, 3.0f }, { 4.0f, 3.0f },
{ -1.0f, 1.0f }, { -1.0f, 1.0f },
{ 100.0f, -100.0f }, { 100.0f, -100.0f },
@ -29,10 +29,10 @@ static const float _TEST_FP32_MODULUS_LIST[] = {
void test_complex_square_modulus_fp32() void test_complex_square_modulus_fp32()
{ {
print_testing_name("bgc_complex_get_square_modulus_fp32"); print_testing_name("bgc_fp32_complex_get_square_modulus");
for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_complex_get_square_modulus_fp32(&_TEST_FP32_COMPLEX_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) { if (!bgc_fp32_are_close(bgc_fp32_complex_get_square_modulus(&_TEST_FP32_COMPLEX_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -43,10 +43,10 @@ void test_complex_square_modulus_fp32()
void test_complex_modulus_fp32() void test_complex_modulus_fp32()
{ {
print_testing_name("bgc_complex_get_modulus_fp32"); print_testing_name("bgc_fp32_complex_get_modulus");
for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_complex_get_modulus_fp32(&_TEST_FP32_COMPLEX_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) { if (!bgc_fp32_are_close(bgc_fp32_complex_get_modulus(&_TEST_FP32_COMPLEX_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -59,7 +59,7 @@ void test_complex_modulus_fp32()
static const int _TEST_FP64_COMPLEX_AMOUNT = 4; static const int _TEST_FP64_COMPLEX_AMOUNT = 4;
static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST[] = { static const BGC_FP64_Complex _TEST_FP64_COMPLEX_LIST[] = {
{ 4.0, 3.0 }, { 4.0, 3.0 },
{ -1.0, -1.0 }, { -1.0, -1.0 },
{ -100.0, 100.0 }, { -100.0, 100.0 },
@ -82,10 +82,10 @@ static const double _TEST_FP64_MODULUS_LIST[] = {
void test_complex_square_modulus_fp64() void test_complex_square_modulus_fp64()
{ {
print_testing_name("bgc_complex_get_square_modulus_fp64"); print_testing_name("bgc_fp64_complex_get_square_modulus");
for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_complex_get_square_modulus_fp64(&_TEST_FP64_COMPLEX_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) { if (!bgc_fp64_are_close(bgc_fp64_complex_get_square_modulus(&_TEST_FP64_COMPLEX_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -96,10 +96,10 @@ void test_complex_square_modulus_fp64()
void test_complex_modulus_fp64() void test_complex_modulus_fp64()
{ {
print_testing_name("bgc_complex_get_modulus_fp64"); print_testing_name("bgc_fp64_complex_get_modulus");
for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_complex_get_modulus_fp64(&_TEST_FP64_COMPLEX_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) { if (!bgc_fp64_are_close(bgc_fp64_complex_get_modulus(&_TEST_FP64_COMPLEX_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }

View file

@ -4,11 +4,11 @@
void test_complex_reset_fp32() void test_complex_reset_fp32()
{ {
BgcComplexFP32 vector; BGC_FP32_Complex vector;
print_testing_name("bgc_complex_reset_fp32"); print_testing_name("bgc_fp32_complex_reset");
bgc_complex_reset_fp32(&vector); bgc_fp32_complex_reset(&vector);
if (vector.real != 0.0f || vector.imaginary != 0.0f) { if (vector.real != 0.0f || vector.imaginary != 0.0f) {
print_testing_failed(); print_testing_failed();
@ -20,11 +20,11 @@ void test_complex_reset_fp32()
void test_complex_reset_fp64() void test_complex_reset_fp64()
{ {
BgcComplexFP64 vector; BGC_FP64_Complex vector;
print_testing_name("bgc_complex_reset_fp64"); print_testing_name("bgc_fp64_complex_reset");
bgc_complex_reset_fp64(&vector); bgc_fp64_complex_reset(&vector);
if (vector.real != 0.0 || vector.imaginary != 0.0) { if (vector.real != 0.0 || vector.imaginary != 0.0) {
print_testing_failed(); print_testing_failed();

View file

@ -8,25 +8,25 @@
void test_complex_set_values_fp32() void test_complex_set_values_fp32()
{ {
BgcComplexFP32 vector; BGC_FP32_Complex vector;
print_testing_name("bgc_complex_set_values_fp32"); print_testing_name("bgc_fp32_complex_make");
bgc_complex_set_values_fp32(1.0f, 2.0f, &vector); bgc_fp32_complex_make(1.0f, 2.0f, &vector);
if (vector.real != 1.0f || vector.imaginary != 2.0f) { if (vector.real != 1.0f || vector.imaginary != 2.0f) {
print_testing_error("First step failed"); print_testing_error("First step failed");
return; return;
} }
bgc_complex_set_values_fp32(-1.0f, -3.0f, &vector); bgc_fp32_complex_make(-1.0f, -3.0f, &vector);
if (vector.real != -1.0f || vector.imaginary != -3.0f) { if (vector.real != -1.0f || vector.imaginary != -3.0f) {
print_testing_error("Second step failed"); print_testing_error("Second step failed");
return; return;
} }
bgc_complex_set_values_fp32(-8.0f, -2.0f, &vector); bgc_fp32_complex_make(-8.0f, -2.0f, &vector);
if (vector.real != -8.0f || vector.imaginary != -2.0f) { if (vector.real != -8.0f || vector.imaginary != -2.0f) {
print_testing_error("Third step failed"); print_testing_error("Third step failed");
@ -40,25 +40,25 @@ void test_complex_set_values_fp32()
void test_complex_set_values_fp64() void test_complex_set_values_fp64()
{ {
BgcComplexFP64 vector; BGC_FP64_Complex vector;
print_testing_name("bgc_complex_set_values_fp64"); print_testing_name("bgc_fp64_complex_make");
bgc_complex_set_values_fp64(1.0, 2.0, &vector); bgc_fp64_complex_make(1.0, 2.0, &vector);
if (vector.real != 1.0 || vector.imaginary != 2.0) { if (vector.real != 1.0 || vector.imaginary != 2.0) {
print_testing_error("First step failed"); print_testing_error("First step failed");
return; return;
} }
bgc_complex_set_values_fp64(-1.0, -3.0, &vector); bgc_fp64_complex_make(-1.0, -3.0, &vector);
if (vector.real != -1.0 || vector.imaginary != -3.0) { if (vector.real != -1.0 || vector.imaginary != -3.0) {
print_testing_error("Second step failed"); print_testing_error("Second step failed");
return; return;
} }
bgc_complex_set_values_fp64(-8.0, -2.0, &vector); bgc_fp64_complex_make(-8.0, -2.0, &vector);
if (vector.real != -8.0 || vector.imaginary != -2.0) { if (vector.real != -8.0 || vector.imaginary != -2.0) {
print_testing_error("Third step failed"); print_testing_error("Third step failed");

View file

@ -8,14 +8,14 @@
static const int _TEST_FP32_COMPLEX_AMOUNT = 4; static const int _TEST_FP32_COMPLEX_AMOUNT = 4;
static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST1[] = { static const BGC_FP32_Complex _TEST_FP32_COMPLEX_LIST1[] = {
{ 3.0f, 4.0f }, { 3.0f, 4.0f },
{ -2.0f, -1.0f }, { -2.0f, -1.0f },
{ -244.8f, 100.0f }, { -244.8f, 100.0f },
{ 1000.32f, -100.1f } { 1000.32f, -100.1f }
}; };
static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST2[] = { static const BGC_FP32_Complex _TEST_FP32_COMPLEX_LIST2[] = {
{ 5.3f, 1003.28f }, { 5.3f, 1003.28f },
{ -0.0032f, 891.3f }, { -0.0032f, 891.3f },
{ 5.322f, 0.9275f }, { 5.322f, 0.9275f },
@ -24,15 +24,15 @@ static const BgcComplexFP32 _TEST_FP32_COMPLEX_LIST2[] = {
void test_complex_swap_fp32() void test_complex_swap_fp32()
{ {
BgcComplexFP32 compleimaginary, complex2; BGC_FP32_Complex compleimaginary, complex2;
print_testing_name("bgc_complex_swap_fp32"); print_testing_name("bgc_fp32_complex_swap");
for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_COMPLEX_AMOUNT; i++) {
bgc_complex_copy_fp32(&_TEST_FP32_COMPLEX_LIST1[i], &compleimaginary); bgc_fp32_complex_copy(&_TEST_FP32_COMPLEX_LIST1[i], &compleimaginary);
bgc_complex_copy_fp32(&_TEST_FP32_COMPLEX_LIST2[i], &complex2); bgc_fp32_complex_copy(&_TEST_FP32_COMPLEX_LIST2[i], &complex2);
bgc_complex_swap_fp32(&compleimaginary, &complex2); bgc_fp32_complex_swap(&compleimaginary, &complex2);
if (compleimaginary.real != _TEST_FP32_COMPLEX_LIST2[i].real || if (compleimaginary.real != _TEST_FP32_COMPLEX_LIST2[i].real ||
compleimaginary.imaginary != _TEST_FP32_COMPLEX_LIST2[i].imaginary || compleimaginary.imaginary != _TEST_FP32_COMPLEX_LIST2[i].imaginary ||
@ -50,14 +50,14 @@ void test_complex_swap_fp32()
static const int _TEST_FP64_COMPLEX_AMOUNT = 4; static const int _TEST_FP64_COMPLEX_AMOUNT = 4;
static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST1[] = { static const BGC_FP64_Complex _TEST_FP64_COMPLEX_LIST1[] = {
{ 1.0, 4.0 }, { 1.0, 4.0 },
{ -4.0, -3.0 }, { -4.0, -3.0 },
{ -244.8, 344.7 }, { -244.8, 344.7 },
{ 1000.32, -271.3 } { 1000.32, -271.3 }
}; };
static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST2[] = { static const BGC_FP64_Complex _TEST_FP64_COMPLEX_LIST2[] = {
{ -0.123, 1003.28 }, { -0.123, 1003.28 },
{ 204.07, -781.89 }, { 204.07, -781.89 },
{ 5.322, 0.9275 }, { 5.322, 0.9275 },
@ -66,15 +66,15 @@ static const BgcComplexFP64 _TEST_FP64_COMPLEX_LIST2[] = {
void test_complex_swap_fp64() void test_complex_swap_fp64()
{ {
BgcComplexFP64 compleimaginary, complex2; BGC_FP64_Complex compleimaginary, complex2;
print_testing_name("bgc_complex_swap_fp64"); print_testing_name("bgc_fp64_complex_swap");
for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_COMPLEX_AMOUNT; i++) {
bgc_complex_copy_fp64(&_TEST_FP64_COMPLEX_LIST1[i], &compleimaginary); bgc_fp64_complex_copy(&_TEST_FP64_COMPLEX_LIST1[i], &compleimaginary);
bgc_complex_copy_fp64(&_TEST_FP64_COMPLEX_LIST2[i], &complex2); bgc_fp64_complex_copy(&_TEST_FP64_COMPLEX_LIST2[i], &complex2);
bgc_complex_swap_fp64(&compleimaginary, &complex2); bgc_fp64_complex_swap(&compleimaginary, &complex2);
if (compleimaginary.real != _TEST_FP64_COMPLEX_LIST2[i].real || if (compleimaginary.real != _TEST_FP64_COMPLEX_LIST2[i].real ||
compleimaginary.imaginary != _TEST_FP64_COMPLEX_LIST2[i].imaginary || compleimaginary.imaginary != _TEST_FP64_COMPLEX_LIST2[i].imaginary ||

View file

@ -7,7 +7,7 @@
// ==================== FP32 ==================== // // ==================== FP32 ==================== //
static const int _TEST_FP32_QUATERNION_AMOUNT = 4; static const int _TEST_FP32_QUATERNION_AMOUNT = 4;
static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = { static const BGC_FP32_Quaternion _TEST_FP32_QUATERNION_LIST[] = {
{ 1.0f, 2.0f, 3.0f, 4.0f }, { 1.0f, 2.0f, 3.0f, 4.0f },
{ -4.0f, -3.0f, -2.0f, -1.0f }, { -4.0f, -3.0f, -2.0f, -1.0f },
{ -0.001f, 100.0f, -100.0f, 0.001f }, { -0.001f, 100.0f, -100.0f, 0.001f },
@ -16,13 +16,13 @@ static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = {
void test_quaternion_copy_fp32() void test_quaternion_copy_fp32()
{ {
BgcQuaternionFP32 vector; BGC_FP32_Quaternion vector;
print_testing_name("bgc_quaternion_copy_fp32"); print_testing_name("bgc_fp32_quaternion_copy");
for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST[i], &vector); bgc_fp32_quaternion_copy(&_TEST_FP32_QUATERNION_LIST[i], &vector);
if (vector.s0 != _TEST_FP32_QUATERNION_LIST[i].s0 || if (vector.s0 != _TEST_FP32_QUATERNION_LIST[i].s0 ||
vector.x1 != _TEST_FP32_QUATERNION_LIST[i].x1 || vector.x1 != _TEST_FP32_QUATERNION_LIST[i].x1 ||
@ -39,7 +39,7 @@ void test_quaternion_copy_fp32()
// ==================== FP64 ==================== // // ==================== FP64 ==================== //
static const int _TEST_FP64_QUATERNION_AMOUNT = 4; static const int _TEST_FP64_QUATERNION_AMOUNT = 4;
static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = { static const BGC_FP64_Quaternion _TEST_FP64_QUATERNION_LIST[] = {
{ 1.0, 2.0, 3.0, 4.0 }, { 1.0, 2.0, 3.0, 4.0 },
{ -4.0, -3.0, -2.0, -1.0 }, { -4.0, -3.0, -2.0, -1.0 },
{ -0.001, 100.0, -100.0, 0.001 }, { -0.001, 100.0, -100.0, 0.001 },
@ -48,13 +48,13 @@ static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = {
void test_quaternion_copy_fp64() void test_quaternion_copy_fp64()
{ {
BgcQuaternionFP64 vector; BGC_FP64_Quaternion vector;
print_testing_name("bgc_quaternion_copy_fp64"); print_testing_name("bgc_fp64_quaternion_copy");
for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST[i], &vector); bgc_fp64_quaternion_copy(&_TEST_FP64_QUATERNION_LIST[i], &vector);
if (vector.s0 != _TEST_FP64_QUATERNION_LIST[i].s0 || if (vector.s0 != _TEST_FP64_QUATERNION_LIST[i].s0 ||
vector.x1 != _TEST_FP64_QUATERNION_LIST[i].x1 || vector.x1 != _TEST_FP64_QUATERNION_LIST[i].x1 ||

View file

@ -7,45 +7,45 @@
static const int _TEST_FP32_UNIT_QUATERNION_AMOUNT = 16; static const int _TEST_FP32_UNIT_QUATERNION_AMOUNT = 16;
static const int _TEST_FP32_NONUNIT_QUATERNION_AMOUNT = 10; static const int _TEST_FP32_NONUNIT_QUATERNION_AMOUNT = 10;
static const BgcQuaternionFP32 _TEST_FP32_UNIT_QUATERNION_LIST[] = { static const BGC_FP32_Quaternion _TEST_FP32_UNIT_QUATERNION_LIST[] = {
{ 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f },
{ -1.0f, 0.0f, 0.0f, 0.0f }, { -1.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, -0.8f, 0.6f, 0.0f }, { 0.0f, -0.8f, 0.6f, 0.0f },
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON },
{ 0.5f, 0.5f, 0.5f, 0.5f }, { 0.5f, 0.5f, 0.5f, 0.5f },
{ 0.5f + 0.75f * BGC_EPSYLON_FP32, 0.5f, 0.5f, 0.5f }, { 0.5f + 0.75f * BGC_FP32_EPSYLON, 0.5f, 0.5f, 0.5f },
{ 0.5f, 0.5f - 0.75f * BGC_EPSYLON_FP32, 0.5f, 0.5f }, { 0.5f, 0.5f - 0.75f * BGC_FP32_EPSYLON, 0.5f, 0.5f },
{ 0.5f, 0.5f, 0.5f + 0.75f * BGC_EPSYLON_FP32, 0.5f }, { 0.5f, 0.5f, 0.5f + 0.75f * BGC_FP32_EPSYLON, 0.5f },
{ 0.5f, 0.5f, 0.5f, 0.5f - 0.75f * BGC_EPSYLON_FP32 } { 0.5f, 0.5f, 0.5f, 0.5f - 0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcQuaternionFP32 _TEST_FP32_NONUNIT_QUATERION_LIST[] = { static const BGC_FP32_Quaternion _TEST_FP32_NONUNIT_QUATERION_LIST[] = {
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON },
{ 0.5f + 1.25f * BGC_EPSYLON_FP32, 0.5f + 1.25f * BGC_EPSYLON_FP32, 0.5f, 0.5f }, { 0.5f + 1.25f * BGC_FP32_EPSYLON, 0.5f + 1.25f * BGC_FP32_EPSYLON, 0.5f, 0.5f },
{ 0.5f - 1.25f * BGC_EPSYLON_FP32, 0.5f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.5f } { 0.5f - 1.25f * BGC_FP32_EPSYLON, 0.5f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.5f }
}; };
void test_quaternion_is_unit_fp32() void test_quaternion_is_unit_fp32()
{ {
print_testing_name("bgc_quaternion_is_unit_fp32"); print_testing_name("bgc_fp32_quaternion_is_unit");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_UNIT_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_UNIT_QUATERNION_AMOUNT; i++) {
if (!bgc_quaternion_is_unit_fp32(&_TEST_FP32_UNIT_QUATERNION_LIST[i])) { if (!bgc_fp32_quaternion_is_unit(&_TEST_FP32_UNIT_QUATERNION_LIST[i])) {
print_testing_error("A unit quaternion was not recognized"); print_testing_error("A unit quaternion was not recognized");
return; return;
} }
@ -53,7 +53,7 @@ void test_quaternion_is_unit_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONUNIT_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONUNIT_QUATERNION_AMOUNT; i++) {
if (bgc_quaternion_is_unit_fp32(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) { if (bgc_fp32_quaternion_is_unit(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) {
print_testing_error("A non-unit quaternion was recognized a unit quaternion"); print_testing_error("A non-unit quaternion was recognized a unit quaternion");
return; return;
} }
@ -67,45 +67,45 @@ void test_quaternion_is_unit_fp32()
static const int _TEST_FP64_UNIT_QUATERNION_AMOUNT = 16; static const int _TEST_FP64_UNIT_QUATERNION_AMOUNT = 16;
static const int _TEST_FP64_NONUNIT_QUATERNION_AMOUNT = 10; static const int _TEST_FP64_NONUNIT_QUATERNION_AMOUNT = 10;
static const BgcQuaternionFP64 _TEST_FP64_UNIT_QUATERNION_LIST[] = { static const BGC_FP64_Quaternion _TEST_FP64_UNIT_QUATERNION_LIST[] = {
{ 1.0, 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0, 0.0 },
{ -1.0, 0.0, 0.0, 0.0 }, { -1.0, 0.0, 0.0, 0.0 },
{ 0.0, -0.6, 0.8, 0.0 }, { 0.0, -0.6, 0.8, 0.0 },
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON },
{ 0.5, 0.5, 0.5, 0.5 }, { 0.5, 0.5, 0.5, 0.5 },
{ 0.5 + 0.75 * BGC_EPSYLON_FP64, 0.5, 0.5, 0.5 }, { 0.5 + 0.75 * BGC_FP64_EPSYLON, 0.5, 0.5, 0.5 },
{ 0.5, 0.5 - 0.75 * BGC_EPSYLON_FP64, 0.5, 0.5 }, { 0.5, 0.5 - 0.75 * BGC_FP64_EPSYLON, 0.5, 0.5 },
{ 0.5, 0.5, 0.5 + 0.75 * BGC_EPSYLON_FP64, 0.5 }, { 0.5, 0.5, 0.5 + 0.75 * BGC_FP64_EPSYLON, 0.5 },
{ 0.5, 0.5, 0.5, 0.5 - 0.75 * BGC_EPSYLON_FP64 } { 0.5, 0.5, 0.5, 0.5 - 0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcQuaternionFP64 _TEST_FP64_NONUNIT_QUATERION_LIST[] = { static const BGC_FP64_Quaternion _TEST_FP64_NONUNIT_QUATERION_LIST[] = {
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON },
{ 0.5 + 1.25 * BGC_EPSYLON_FP64, 0.5 + 1.25 * BGC_EPSYLON_FP64, 0.5, 0.5 }, { 0.5 + 1.25 * BGC_FP64_EPSYLON, 0.5 + 1.25 * BGC_FP64_EPSYLON, 0.5, 0.5 },
{ 0.5 - 1.25 * BGC_EPSYLON_FP64, 0.5 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.5 } { 0.5 - 1.25 * BGC_FP64_EPSYLON, 0.5 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.5 }
}; };
void test_quaternion_is_unit_fp64() void test_quaternion_is_unit_fp64()
{ {
print_testing_name("bgc_quaternion_is_unit_fp64"); print_testing_name("bgc_fp64_quaternion_is_unit");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_UNIT_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_UNIT_QUATERNION_AMOUNT; i++) {
if (!bgc_quaternion_is_unit_fp64(&_TEST_FP64_UNIT_QUATERNION_LIST[i])) { if (!bgc_fp64_quaternion_is_unit(&_TEST_FP64_UNIT_QUATERNION_LIST[i])) {
print_testing_error("A unit quaternion was not recognized"); print_testing_error("A unit quaternion was not recognized");
return; return;
} }
@ -113,7 +113,7 @@ void test_quaternion_is_unit_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONUNIT_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONUNIT_QUATERNION_AMOUNT; i++) {
if (bgc_quaternion_is_unit_fp64(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) { if (bgc_fp64_quaternion_is_unit(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) {
print_testing_error("A non-unit quaternion was recognized a unit quaternion"); print_testing_error("A non-unit quaternion was recognized a unit quaternion");
return; return;
} }

View file

@ -7,39 +7,39 @@
static const int _TEST_FP32_ZERO_QUATERNION_AMOUNT = 9; static const int _TEST_FP32_ZERO_QUATERNION_AMOUNT = 9;
static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 11; static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 11;
static const BgcQuaternionFP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = { static const BGC_FP32_Quaternion _TEST_FP32_ZERO_QUATERNION_LIST[] = {
{ 0.0f, 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { -0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, -0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, -0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32 } { 0.0f, 0.0f, 0.0f, -0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcQuaternionFP32 _TEST_FP32_NONZERO_QUATERION_LIST[] = { static const BGC_FP32_Quaternion _TEST_FP32_NONZERO_QUATERION_LIST[] = {
{ 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f },
{ 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.0f, -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.0f, -1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.0f, -1.25f * BGC_FP32_EPSYLON },
{ 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.25f * BGC_FP32_EPSYLON, 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f } { -1.25f * BGC_FP32_EPSYLON, -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f }
}; };
void test_quaternion_is_zero_fp32() void test_quaternion_is_zero_fp32()
{ {
print_testing_name("bgc_quaternion_is_zero_fp32"); print_testing_name("bgc_fp32_quaternion_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) {
if (!bgc_quaternion_is_zero_fp32(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) { if (!bgc_fp32_quaternion_is_zero(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) {
print_testing_error("A zero quaternion was not recognized"); print_testing_error("A zero quaternion was not recognized");
return; return;
} }
@ -47,7 +47,7 @@ void test_quaternion_is_zero_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONZERO_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONZERO_QUATERNION_AMOUNT; i++) {
if (bgc_quaternion_is_zero_fp32(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) { if (bgc_fp32_quaternion_is_zero(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) {
print_testing_error("A non-zero quaternion was recognized as a zero quaternion"); print_testing_error("A non-zero quaternion was recognized as a zero quaternion");
return; return;
} }
@ -61,39 +61,39 @@ void test_quaternion_is_zero_fp32()
static const int _TEST_FP64_ZERO_QUATERNION_AMOUNT = 9; static const int _TEST_FP64_ZERO_QUATERNION_AMOUNT = 9;
static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 11; static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 11;
static const BgcQuaternionFP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = { static const BGC_FP64_Quaternion _TEST_FP64_ZERO_QUATERNION_LIST[] = {
{ 0.0, 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0, 0.0 },
{ 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { -0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, -0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, -0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, 0.75 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64 } { 0.0, 0.0, 0.0, -0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcQuaternionFP64 _TEST_FP64_NONZERO_QUATERION_LIST[] = { static const BGC_FP64_Quaternion _TEST_FP64_NONZERO_QUATERION_LIST[] = {
{ 0.0, 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 },
{ 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { -1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.0, -1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.0, -1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, 1.25 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.0, -1.25 * BGC_FP64_EPSYLON },
{ 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.25 * BGC_FP64_EPSYLON, 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ -1.25 * BGC_EPSYLON_FP64, -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 } { -1.25 * BGC_FP64_EPSYLON, -1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 }
}; };
void test_quaternion_is_zero_fp64() void test_quaternion_is_zero_fp64()
{ {
print_testing_name("bgc_quaternion_is_zero_fp64"); print_testing_name("bgc_fp64_quaternion_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) {
if (!bgc_quaternion_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) { if (!bgc_fp64_quaternion_is_zero(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) {
print_testing_error("A zero quaternion was not recognized"); print_testing_error("A zero quaternion was not recognized");
return; return;
} }
@ -101,7 +101,7 @@ void test_quaternion_is_zero_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONZERO_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONZERO_QUATERNION_AMOUNT; i++) {
if (bgc_quaternion_is_zero_fp64(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) { if (bgc_fp64_quaternion_is_zero(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) {
print_testing_error("A non-zero quaternion was recognized as a zero quaternion"); print_testing_error("A non-zero quaternion was recognized as a zero quaternion");
return; return;
} }

View file

@ -6,7 +6,7 @@
static const int _TEST_FP32_QUATERNION_AMOUNT = 4; static const int _TEST_FP32_QUATERNION_AMOUNT = 4;
static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = { static const BGC_FP32_Quaternion _TEST_FP32_QUATERNION_LIST[] = {
{ 0.0f, 4.0f, 3.0f, 0.0f }, { 0.0f, 4.0f, 3.0f, 0.0f },
{ -1.0f, 1.0f, -1.0f, 1.0f }, { -1.0f, 1.0f, -1.0f, 1.0f },
{ 100.0f, -100.0f, 0.0f, 100.0f }, { 100.0f, -100.0f, 0.0f, 100.0f },
@ -29,10 +29,10 @@ static const float _TEST_FP32_MODULUS_LIST[] = {
void test_quaternion_square_modulus_fp32() void test_quaternion_square_modulus_fp32()
{ {
print_testing_name("bgc_quaternion_get_square_modulus_fp32"); print_testing_name("bgc_fp32_quaternion_get_square_modulus");
for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_quaternion_get_square_modulus_fp32(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) { if (!bgc_fp32_are_close(bgc_fp32_quaternion_get_square_modulus(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -43,10 +43,10 @@ void test_quaternion_square_modulus_fp32()
void test_quaternion_modulus_fp32() void test_quaternion_modulus_fp32()
{ {
print_testing_name("bgc_quaternion_get_modulus_fp32"); print_testing_name("bgc_fp32_quaternion_get_modulus");
for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_quaternion_get_modulus_fp32(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) { if (!bgc_fp32_are_close(bgc_fp32_quaternion_get_modulus(&_TEST_FP32_QUATERNION_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -59,7 +59,7 @@ void test_quaternion_modulus_fp32()
static const int _TEST_FP64_QUATERNION_AMOUNT = 4; static const int _TEST_FP64_QUATERNION_AMOUNT = 4;
static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = { static const BGC_FP64_Quaternion _TEST_FP64_QUATERNION_LIST[] = {
{ 0.0, 4.0, 3.0, 0.0 }, { 0.0, 4.0, 3.0, 0.0 },
{ -1.0, 1.0, -1.0, 1.0 }, { -1.0, 1.0, -1.0, 1.0 },
{ 100.0, -100.0, 0.0, 100.0 }, { 100.0, -100.0, 0.0, 100.0 },
@ -82,10 +82,10 @@ static const double _TEST_FP64_MODULUS_LIST[] = {
void test_quaternion_square_modulus_fp64() void test_quaternion_square_modulus_fp64()
{ {
print_testing_name("bgc_quaternion_get_square_modulus_fp64"); print_testing_name("bgc_fp64_quaternion_get_square_modulus");
for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_quaternion_get_square_modulus_fp64(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) { if (!bgc_fp64_are_close(bgc_fp64_quaternion_get_square_modulus(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -96,10 +96,10 @@ void test_quaternion_square_modulus_fp64()
void test_quaternion_modulus_fp64() void test_quaternion_modulus_fp64()
{ {
print_testing_name("bgc_quaternion_get_modulus_fp64"); print_testing_name("bgc_fp64_quaternion_get_modulus");
for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_quaternion_get_modulus_fp64(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) { if (!bgc_fp64_are_close(bgc_fp64_quaternion_get_modulus(&_TEST_FP64_QUATERNION_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }

View file

@ -4,11 +4,11 @@
void test_quaternion_reset_fp32() void test_quaternion_reset_fp32()
{ {
BgcQuaternionFP32 vector; BGC_FP32_Quaternion vector;
print_testing_name("bgc_quaternion_reset_fp32"); print_testing_name("bgc_fp32_quaternion_reset");
bgc_quaternion_reset_fp32(&vector); bgc_fp32_quaternion_reset(&vector);
if (vector.s0 != 0.0f || vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) { if (vector.s0 != 0.0f || vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) {
print_testing_failed(); print_testing_failed();
@ -20,11 +20,11 @@ void test_quaternion_reset_fp32()
void test_quaternion_reset_fp64() void test_quaternion_reset_fp64()
{ {
BgcQuaternionFP64 vector; BGC_FP64_Quaternion vector;
print_testing_name("bgc_quaternion_reset_fp64"); print_testing_name("bgc_fp64_quaternion_reset");
bgc_quaternion_reset_fp64(&vector); bgc_fp64_quaternion_reset(&vector);
if (vector.s0 != 0.0 || vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) { if (vector.s0 != 0.0 || vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) {
print_testing_failed(); print_testing_failed();

View file

@ -2,13 +2,13 @@
#include "./../../helpers.h" #include "./../../helpers.h"
void test_quaternion_set_to_identity_fp32() void test_quaternion_make_unit_fp32()
{ {
BgcQuaternionFP32 vector; BGC_FP32_Quaternion vector;
print_testing_name("bgc_quaternion_set_to_identity_fp32"); print_testing_name("bgc_fp32_quaternion_make_unit");
bgc_quaternion_make_unit_fp32(&vector); bgc_fp32_quaternion_make_unit(&vector);
if (vector.s0 != 1.0f || vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) { if (vector.s0 != 1.0f || vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) {
print_testing_failed(); print_testing_failed();
@ -18,13 +18,13 @@ void test_quaternion_set_to_identity_fp32()
print_testing_success(); print_testing_success();
} }
void test_quaternion_set_to_identity_fp64() void test_quaternion_make_unit_fp64()
{ {
BgcQuaternionFP64 vector; BGC_FP64_Quaternion vector;
print_testing_name("bgc_quaternion_set_to_identity_fp64"); print_testing_name("bgc_fp64_quaternion_make_unit");
bgc_quaternion_make_unit_fp64(&vector); bgc_fp64_quaternion_make_unit(&vector);
if (vector.s0 != 1.0 || vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) { if (vector.s0 != 1.0 || vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) {
print_testing_failed(); print_testing_failed();
@ -36,6 +36,6 @@ void test_quaternion_set_to_identity_fp64()
void test_quaternion_set_to_identity() void test_quaternion_set_to_identity()
{ {
test_quaternion_set_to_identity_fp32(); test_quaternion_make_unit_fp32();
test_quaternion_set_to_identity_fp64(); test_quaternion_make_unit_fp64();
} }

View file

@ -1,9 +1,9 @@
#ifndef _TEST_QUATERNION_SET_TO_IDENTITY_H_ #ifndef _TEST_QUATERNION_SET_TO_IDENTITY_H_
#define _TEST_QUATERNION_SET_TO_IDENTITY_H_ #define _TEST_QUATERNION_SET_TO_IDENTITY_H_
void test_quaternion_set_to_identity_fp32(); void test_quaternion_make_unit_fp32();
void test_quaternion_set_to_identity_fp64(); void test_quaternion_make_unit_fp64();
void test_quaternion_set_to_identity(); void test_quaternion_set_to_identity();

View file

@ -8,25 +8,25 @@
void test_quaternion_set_values_fp32() void test_quaternion_set_values_fp32()
{ {
BgcQuaternionFP32 vector; BGC_FP32_Quaternion vector;
print_testing_name("bgc_quaternion_set_values_fp32"); print_testing_name("bgc_fp32_quaternion_make");
bgc_quaternion_set_values_fp32(1.0f, 2.0f, 3.0f, 4.0f, &vector); bgc_fp32_quaternion_make(1.0f, 2.0f, 3.0f, 4.0f, &vector);
if (vector.s0 != 1.0f || vector.x1 != 2.0f || vector.x2 != 3.0f || vector.x3 != 4.0f) { if (vector.s0 != 1.0f || vector.x1 != 2.0f || vector.x2 != 3.0f || vector.x3 != 4.0f) {
print_testing_error("First step failed"); print_testing_error("First step failed");
return; return;
} }
bgc_quaternion_set_values_fp32(-1.0f, -3.0f, -5.0f, -7.0f, &vector); bgc_fp32_quaternion_make(-1.0f, -3.0f, -5.0f, -7.0f, &vector);
if (vector.s0 != -1.0f || vector.x1 != -3.0f || vector.x2 != -5.0f || vector.x3 != -7.0f) { if (vector.s0 != -1.0f || vector.x1 != -3.0f || vector.x2 != -5.0f || vector.x3 != -7.0f) {
print_testing_error("Second step failed"); print_testing_error("Second step failed");
return; return;
} }
bgc_quaternion_set_values_fp32(-8.0f, -2.0f, 2.0f, 4.0f, &vector); bgc_fp32_quaternion_make(-8.0f, -2.0f, 2.0f, 4.0f, &vector);
if (vector.s0 != -8.0f || vector.x1 != -2.0f || vector.x2 != 2.0f || vector.x3 != 4.0f) { if (vector.s0 != -8.0f || vector.x1 != -2.0f || vector.x2 != 2.0f || vector.x3 != 4.0f) {
print_testing_error("Third step failed"); print_testing_error("Third step failed");
@ -40,25 +40,25 @@ void test_quaternion_set_values_fp32()
void test_quaternion_set_values_fp64() void test_quaternion_set_values_fp64()
{ {
BgcQuaternionFP64 vector; BGC_FP64_Quaternion vector;
print_testing_name("bgc_quaternion_set_values_fp64"); print_testing_name("bgc_fp64_quaternion_make");
bgc_quaternion_set_values_fp64(1.0, 2.0, 3.0, 4.0, &vector); bgc_fp64_quaternion_make(1.0, 2.0, 3.0, 4.0, &vector);
if (vector.s0 != 1.0 || vector.x1 != 2.0 || vector.x2 != 3.0 || vector.x3 != 4.0) { if (vector.s0 != 1.0 || vector.x1 != 2.0 || vector.x2 != 3.0 || vector.x3 != 4.0) {
print_testing_error("First step failed"); print_testing_error("First step failed");
return; return;
} }
bgc_quaternion_set_values_fp64(-1.0, -3.0, -5.0, -7.0, &vector); bgc_fp64_quaternion_make(-1.0, -3.0, -5.0, -7.0, &vector);
if (vector.s0 != -1.0 || vector.x1 != -3.0 || vector.x2 != -5.0 || vector.x3 != -7.0) { if (vector.s0 != -1.0 || vector.x1 != -3.0 || vector.x2 != -5.0 || vector.x3 != -7.0) {
print_testing_error("Second step failed"); print_testing_error("Second step failed");
return; return;
} }
bgc_quaternion_set_values_fp64(-8.0, -2.0, 2.0, 4.0, &vector); bgc_fp64_quaternion_make(-8.0, -2.0, 2.0, 4.0, &vector);
if (vector.s0 != -8.0 || vector.x1 != -2.0 || vector.x2 != 2.0 || vector.x3 != 4.0) { if (vector.s0 != -8.0 || vector.x1 != -2.0 || vector.x2 != 2.0 || vector.x3 != 4.0) {
print_testing_error("Third step failed"); print_testing_error("Third step failed");

View file

@ -8,14 +8,14 @@
static const int _TEST_FP32_QUATERNION_AMOUNT = 4; static const int _TEST_FP32_QUATERNION_AMOUNT = 4;
static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST1[] = { static const BGC_FP32_Quaternion _TEST_FP32_QUATERNION_LIST1[] = {
{ 1.0f, 2.0f, 3.0f, 4.0f }, { 1.0f, 2.0f, 3.0f, 4.0f },
{ -4.0f, -3.0f, -2.0f, -1.0f }, { -4.0f, -3.0f, -2.0f, -1.0f },
{ -244.8f, 100.0f, -100.0f, 344.7f }, { -244.8f, 100.0f, -100.0f, 344.7f },
{ 1000.32f, -100.1f, 100.2f, -271.3f } { 1000.32f, -100.1f, 100.2f, -271.3f }
}; };
static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST2[] = { static const BGC_FP32_Quaternion _TEST_FP32_QUATERNION_LIST2[] = {
{ 3.6f, -0.123f, 5.3f, 1003.28f }, { 3.6f, -0.123f, 5.3f, 1003.28f },
{ 204.07f, -781.89f, -0.0032f, 891.3f }, { 204.07f, -781.89f, -0.0032f, 891.3f },
{ -20.02f, -1.0003f, 5.322f, 0.9275f }, { -20.02f, -1.0003f, 5.322f, 0.9275f },
@ -24,15 +24,15 @@ static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST2[] = {
void test_quaternion_swap_fp32() void test_quaternion_swap_fp32()
{ {
BgcQuaternionFP32 quaternion1, quaternion2; BGC_FP32_Quaternion quaternion1, quaternion2;
print_testing_name("bgc_quaternion_swap_fp32"); print_testing_name("bgc_fp32_quaternion_swap");
for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_QUATERNION_AMOUNT; i++) {
bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST1[i], &quaternion1); bgc_fp32_quaternion_copy(&_TEST_FP32_QUATERNION_LIST1[i], &quaternion1);
bgc_quaternion_copy_fp32(&_TEST_FP32_QUATERNION_LIST2[i], &quaternion2); bgc_fp32_quaternion_copy(&_TEST_FP32_QUATERNION_LIST2[i], &quaternion2);
bgc_quaternion_swap_fp32(&quaternion1, &quaternion2); bgc_fp32_quaternion_swap(&quaternion1, &quaternion2);
if (quaternion1.s0 != _TEST_FP32_QUATERNION_LIST2[i].s0 || if (quaternion1.s0 != _TEST_FP32_QUATERNION_LIST2[i].s0 ||
quaternion1.x1 != _TEST_FP32_QUATERNION_LIST2[i].x1 || quaternion1.x1 != _TEST_FP32_QUATERNION_LIST2[i].x1 ||
@ -54,14 +54,14 @@ void test_quaternion_swap_fp32()
static const int _TEST_FP64_QUATERNION_AMOUNT = 4; static const int _TEST_FP64_QUATERNION_AMOUNT = 4;
static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST1[] = { static const BGC_FP64_Quaternion _TEST_FP64_QUATERNION_LIST1[] = {
{ 1.0, 2.0, 3.0, 4.0 }, { 1.0, 2.0, 3.0, 4.0 },
{ -4.0, -3.0, -2.0, -1.0 }, { -4.0, -3.0, -2.0, -1.0 },
{ -244.8, 100.0, -100.0, 344.7 }, { -244.8, 100.0, -100.0, 344.7 },
{ 1000.32, -100.1, 100.2, -271.3 } { 1000.32, -100.1, 100.2, -271.3 }
}; };
static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST2[] = { static const BGC_FP64_Quaternion _TEST_FP64_QUATERNION_LIST2[] = {
{ 3.6, -0.123, 5.3, 1003.28 }, { 3.6, -0.123, 5.3, 1003.28 },
{ 204.07, -781.89, -0.0032, 891.3 }, { 204.07, -781.89, -0.0032, 891.3 },
{ -20.02, -1.0003, 5.322, 0.9275 }, { -20.02, -1.0003, 5.322, 0.9275 },
@ -70,15 +70,15 @@ static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST2[] = {
void test_quaternion_swap_fp64() void test_quaternion_swap_fp64()
{ {
BgcQuaternionFP64 quaternion1, quaternion2; BGC_FP64_Quaternion quaternion1, quaternion2;
print_testing_name("bgc_quaternion_swap_fp64"); print_testing_name("bgc_fp64_quaternion_swap");
for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_QUATERNION_AMOUNT; i++) {
bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST1[i], &quaternion1); bgc_fp64_quaternion_copy(&_TEST_FP64_QUATERNION_LIST1[i], &quaternion1);
bgc_quaternion_copy_fp64(&_TEST_FP64_QUATERNION_LIST2[i], &quaternion2); bgc_fp64_quaternion_copy(&_TEST_FP64_QUATERNION_LIST2[i], &quaternion2);
bgc_quaternion_swap_fp64(&quaternion1, &quaternion2); bgc_fp64_quaternion_swap(&quaternion1, &quaternion2);
if (quaternion1.s0 != _TEST_FP64_QUATERNION_LIST2[i].s0 || if (quaternion1.s0 != _TEST_FP64_QUATERNION_LIST2[i].s0 ||
quaternion1.x1 != _TEST_FP64_QUATERNION_LIST2[i].x1 || quaternion1.x1 != _TEST_FP64_QUATERNION_LIST2[i].x1 ||

View file

@ -12,22 +12,22 @@ static const TestNumberPairFP32 _TEST_FP32_DATA_CLOSE[] = {
{1.0f, 1.0f}, {1.0f, 1.0f},
{-1.0f, -1.0f}, {-1.0f, -1.0f},
{-0.4f * BGC_EPSYLON_FP32, 0.4f * BGC_EPSYLON_FP32}, {-0.4f * BGC_FP32_EPSYLON, 0.4f * BGC_FP32_EPSYLON},
{1.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32}, {1.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON},
{1.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32}, {1.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON},
{1.0f + 0.75f * BGC_EPSYLON_FP32, 1.0f}, {1.0f + 0.75f * BGC_FP32_EPSYLON, 1.0f},
{1.0f - 0.75f * BGC_EPSYLON_FP32, 1.0f}, {1.0f - 0.75f * BGC_FP32_EPSYLON, 1.0f},
{-1.0f, -1.0f + 0.75f * BGC_EPSYLON_FP32}, {-1.0f, -1.0f + 0.75f * BGC_FP32_EPSYLON},
{-1.0f, -1.0f - 0.75f * BGC_EPSYLON_FP32}, {-1.0f, -1.0f - 0.75f * BGC_FP32_EPSYLON},
{-1.0f + 0.75f * BGC_EPSYLON_FP32, -1.0f}, {-1.0f + 0.75f * BGC_FP32_EPSYLON, -1.0f},
{-1.0f - 0.75f * BGC_EPSYLON_FP32, -1.0f}, {-1.0f - 0.75f * BGC_FP32_EPSYLON, -1.0f},
{100.0f, 100.0f * (1.0f + 0.75f * BGC_EPSYLON_FP32)}, {100.0f, 100.0f * (1.0f + 0.75f * BGC_FP32_EPSYLON)},
{100.0f, 100.0f * (1.0f - 0.75f * BGC_EPSYLON_FP32)}, {100.0f, 100.0f * (1.0f - 0.75f * BGC_FP32_EPSYLON)},
{-100.0f, -100.0f * (1.0f + 0.75f * BGC_EPSYLON_FP32)}, {-100.0f, -100.0f * (1.0f + 0.75f * BGC_FP32_EPSYLON)},
{-100.0f, -100.0f * (1.0f - 0.75f * BGC_EPSYLON_FP32)} {-100.0f, -100.0f * (1.0f - 0.75f * BGC_FP32_EPSYLON)}
}; };
static const TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = { static const TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
@ -35,31 +35,31 @@ static const TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
{1.0f, 0.999f}, {1.0f, 0.999f},
{-1.0f, -0.999f}, {-1.0f, -0.999f},
{-0.6f * BGC_EPSYLON_FP32, 0.6f * BGC_EPSYLON_FP32}, {-0.6f * BGC_FP32_EPSYLON, 0.6f * BGC_FP32_EPSYLON},
{1.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32}, {1.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON},
{1.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32}, {1.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON},
{1.0f + 1.25f * BGC_EPSYLON_FP32, 1.0f}, {1.0f + 1.25f * BGC_FP32_EPSYLON, 1.0f},
{1.0f - 1.25f * BGC_EPSYLON_FP32, 1.0f}, {1.0f - 1.25f * BGC_FP32_EPSYLON, 1.0f},
{-1.0f, -1.0f + 1.25f * BGC_EPSYLON_FP32}, {-1.0f, -1.0f + 1.25f * BGC_FP32_EPSYLON},
{-1.0f, -1.0f - 1.25f * BGC_EPSYLON_FP32}, {-1.0f, -1.0f - 1.25f * BGC_FP32_EPSYLON},
{-1.0f + 1.25f * BGC_EPSYLON_FP32, -1.0f}, {-1.0f + 1.25f * BGC_FP32_EPSYLON, -1.0f},
{-1.0f - 1.25f * BGC_EPSYLON_FP32, -1.0f}, {-1.0f - 1.25f * BGC_FP32_EPSYLON, -1.0f},
{100.0f, 100.0f * (1.0f + 1.25f * BGC_EPSYLON_FP32)}, {100.0f, 100.0f * (1.0f + 1.25f * BGC_FP32_EPSYLON)},
{100.0f, 100.0f * (1.0f - 1.25f * BGC_EPSYLON_FP32)}, {100.0f, 100.0f * (1.0f - 1.25f * BGC_FP32_EPSYLON)},
{-100.0f, -100.0f * (1.0f + 1.25f * BGC_EPSYLON_FP32)}, {-100.0f, -100.0f * (1.0f + 1.25f * BGC_FP32_EPSYLON)},
{-100.0f, -100.0f * (1.0f - 1.25f * BGC_EPSYLON_FP32)} {-100.0f, -100.0f * (1.0f - 1.25f * BGC_FP32_EPSYLON)}
}; };
void test_are_close_fp32() void test_are_close_fp32()
{ {
print_testing_name("bgc_are_close_fp32"); print_testing_name("bgc_fp32_are_close");
// Testing close pairs of values: // Testing close pairs of values:
for (int i = 0; i < _TEST_FP32_CLOSE_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_CLOSE_NUMBERS_AMOUNT; i++) {
if (!bgc_are_close_fp32(_TEST_FP32_DATA_CLOSE[i].number1, _TEST_FP32_DATA_CLOSE[i].number2)) { if (!bgc_fp32_are_close(_TEST_FP32_DATA_CLOSE[i].number1, _TEST_FP32_DATA_CLOSE[i].number2)) {
print_testing_error("A pair of close numbers was not recognized"); print_testing_error("A pair of close numbers was not recognized");
return; return;
} }
@ -67,7 +67,7 @@ void test_are_close_fp32()
// Testing different pairs of values: // Testing different pairs of values:
for (int i = 0; i < _TEST_FP32_DIFFERENT_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_DIFFERENT_NUMBERS_AMOUNT; i++) {
if (bgc_are_close_fp32(_TEST_FP32_DATA_DIFFERENT[i].number1, _TEST_FP32_DATA_DIFFERENT[i].number2)) { if (bgc_fp32_are_close(_TEST_FP32_DATA_DIFFERENT[i].number1, _TEST_FP32_DATA_DIFFERENT[i].number2)) {
print_testing_error("A pair of close numbers was not recognized"); print_testing_error("A pair of close numbers was not recognized");
return; return;
} }
@ -86,22 +86,22 @@ static const TestNumberPairFP64 _TEST_FP64_DATA_CLOSE[] = {
{1.0, 1.0}, {1.0, 1.0},
{-1.0, -1.0}, {-1.0, -1.0},
{-0.4 * BGC_EPSYLON_FP64, 0.4 * BGC_EPSYLON_FP64}, {-0.4 * BGC_FP64_EPSYLON, 0.4 * BGC_FP64_EPSYLON},
{1.0, 1.0 + 0.75 * BGC_EPSYLON_FP64}, {1.0, 1.0 + 0.75 * BGC_FP64_EPSYLON},
{1.0, 1.0 - 0.75 * BGC_EPSYLON_FP64}, {1.0, 1.0 - 0.75 * BGC_FP64_EPSYLON},
{1.0 + 0.75 * BGC_EPSYLON_FP64, 1.0}, {1.0 + 0.75 * BGC_FP64_EPSYLON, 1.0},
{1.0 - 0.75 * BGC_EPSYLON_FP64, 1.0}, {1.0 - 0.75 * BGC_FP64_EPSYLON, 1.0},
{-1.0, -1.0 + 0.75 * BGC_EPSYLON_FP64}, {-1.0, -1.0 + 0.75 * BGC_FP64_EPSYLON},
{-1.0, -1.0 - 0.75 * BGC_EPSYLON_FP64}, {-1.0, -1.0 - 0.75 * BGC_FP64_EPSYLON},
{-1.0 + 0.75 * BGC_EPSYLON_FP64, -1.0}, {-1.0 + 0.75 * BGC_FP64_EPSYLON, -1.0},
{-1.0 - 0.75 * BGC_EPSYLON_FP64, -1.0}, {-1.0 - 0.75 * BGC_FP64_EPSYLON, -1.0},
{100.0, 100.0 * (1.0 + 0.75 * BGC_EPSYLON_FP64)}, {100.0, 100.0 * (1.0 + 0.75 * BGC_FP64_EPSYLON)},
{100.0, 100.0 * (1.0 - 0.75 * BGC_EPSYLON_FP64)}, {100.0, 100.0 * (1.0 - 0.75 * BGC_FP64_EPSYLON)},
{-100.0, -100.0 * (1.0 + 0.75 * BGC_EPSYLON_FP64)}, {-100.0, -100.0 * (1.0 + 0.75 * BGC_FP64_EPSYLON)},
{-100.0, -100.0 * (1.0 - 0.75 * BGC_EPSYLON_FP64)} {-100.0, -100.0 * (1.0 - 0.75 * BGC_FP64_EPSYLON)}
}; };
static const TestNumberPairFP64 _TEST_FP64_DATA_DIFFERENT[] = { static const TestNumberPairFP64 _TEST_FP64_DATA_DIFFERENT[] = {
@ -109,31 +109,31 @@ static const TestNumberPairFP64 _TEST_FP64_DATA_DIFFERENT[] = {
{1.0, 0.999999}, {1.0, 0.999999},
{-1.0, -0.999999}, {-1.0, -0.999999},
{-0.6 * BGC_EPSYLON_FP64, 0.6 * BGC_EPSYLON_FP64}, {-0.6 * BGC_FP64_EPSYLON, 0.6 * BGC_FP64_EPSYLON},
{1.0, 1.0 + 1.25 * BGC_EPSYLON_FP64}, {1.0, 1.0 + 1.25 * BGC_FP64_EPSYLON},
{1.0, 1.0 - 1.25 * BGC_EPSYLON_FP64}, {1.0, 1.0 - 1.25 * BGC_FP64_EPSYLON},
{1.0 + 1.25 * BGC_EPSYLON_FP64, 1.0}, {1.0 + 1.25 * BGC_FP64_EPSYLON, 1.0},
{1.0 - 1.25 * BGC_EPSYLON_FP64, 1.0}, {1.0 - 1.25 * BGC_FP64_EPSYLON, 1.0},
{-1.0, -1.0 + 1.25 * BGC_EPSYLON_FP64}, {-1.0, -1.0 + 1.25 * BGC_FP64_EPSYLON},
{-1.0, -1.0 - 1.25 * BGC_EPSYLON_FP64}, {-1.0, -1.0 - 1.25 * BGC_FP64_EPSYLON},
{-1.0 + 1.25 * BGC_EPSYLON_FP64, -1.0}, {-1.0 + 1.25 * BGC_FP64_EPSYLON, -1.0},
{-1.0 - 1.25 * BGC_EPSYLON_FP64, -1.0}, {-1.0 - 1.25 * BGC_FP64_EPSYLON, -1.0},
{100.0, 100.0 * (1.0 + 1.25 * BGC_EPSYLON_FP64)}, {100.0, 100.0 * (1.0 + 1.25 * BGC_FP64_EPSYLON)},
{100.0, 100.0 * (1.0 - 1.25 * BGC_EPSYLON_FP64)}, {100.0, 100.0 * (1.0 - 1.25 * BGC_FP64_EPSYLON)},
{-100.0, -100.0 * (1.0 + 1.25 * BGC_EPSYLON_FP64)}, {-100.0, -100.0 * (1.0 + 1.25 * BGC_FP64_EPSYLON)},
{-100.0, -100.0 * (1.0 - 1.25 * BGC_EPSYLON_FP64)} {-100.0, -100.0 * (1.0 - 1.25 * BGC_FP64_EPSYLON)}
}; };
void test_are_close_fp64() void test_are_close_fp64()
{ {
print_testing_name("bgc_are_close_fp64"); print_testing_name("bgc_fp64_are_close");
// Testing close pairs of values: // Testing close pairs of values:
for (int i = 0; i < _TEST_FP64_CLOSE_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_CLOSE_NUMBERS_AMOUNT; i++) {
if (!bgc_are_close_fp64(_TEST_FP64_DATA_CLOSE[i].number1, _TEST_FP64_DATA_CLOSE[i].number2)) { if (!bgc_fp64_are_close(_TEST_FP64_DATA_CLOSE[i].number1, _TEST_FP64_DATA_CLOSE[i].number2)) {
print_testing_error("A pair of close numbers was not recognized"); print_testing_error("A pair of close numbers was not recognized");
return; return;
} }
@ -141,7 +141,7 @@ void test_are_close_fp64()
// Testing different pairs of values: // Testing different pairs of values:
for (int i = 0; i < _TEST_FP64_DIFFERENT_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_DIFFERENT_NUMBERS_AMOUNT; i++) {
if (bgc_are_close_fp64(_TEST_FP64_DATA_DIFFERENT[i].number1, _TEST_FP64_DATA_DIFFERENT[i].number2)) { if (bgc_fp64_are_close(_TEST_FP64_DATA_DIFFERENT[i].number1, _TEST_FP64_DATA_DIFFERENT[i].number2)) {
print_testing_error("A pair of different numbers was recognized as close numbers"); print_testing_error("A pair of different numbers was recognized as close numbers");
return; return;
} }

View file

@ -9,24 +9,24 @@ static const int _TEST_FP32_NONUNIT_NUMBERS_AMOUNT = 4;
static const float _TEST_FP32_UNIT_NUMBERS[] = { static const float _TEST_FP32_UNIT_NUMBERS[] = {
1.0f, 1.0f,
1.0f + 0.75f * BGC_EPSYLON_FP32, 1.0f + 0.75f * BGC_FP32_EPSYLON,
1.0f - 0.75f * BGC_EPSYLON_FP32 1.0f - 0.75f * BGC_FP32_EPSYLON
}; };
static const float _TEST_FP32_NONUNIT_NUMBERS[] = { static const float _TEST_FP32_NONUNIT_NUMBERS[] = {
0.0f, 0.0f,
-1.0f, -1.0f,
1.0f + 1.25f * BGC_EPSYLON_FP32, 1.0f + 1.25f * BGC_FP32_EPSYLON,
1.0f - 1.25f * BGC_EPSYLON_FP32 1.0f - 1.25f * BGC_FP32_EPSYLON
}; };
void test_is_unit_fp32() void test_is_unit_fp32()
{ {
print_testing_name("bgc_is_unit_fp32"); print_testing_name("bgc_fp32_is_unit");
// Testing unit values: // Testing unit values:
for (int i = 0; i < _TEST_FP32_UNIT_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_UNIT_NUMBERS_AMOUNT; i++) {
if (!bgc_is_unit_fp32(_TEST_FP32_UNIT_NUMBERS[i])) { if (!bgc_fp32_is_unit(_TEST_FP32_UNIT_NUMBERS[i])) {
print_testing_error("A unit value was not recognized"); print_testing_error("A unit value was not recognized");
return; return;
} }
@ -34,7 +34,7 @@ void test_is_unit_fp32()
// Testing non-unit values: // Testing non-unit values:
for (int i = 0; i < _TEST_FP32_NONUNIT_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONUNIT_NUMBERS_AMOUNT; i++) {
if (bgc_is_unit_fp32(_TEST_FP32_NONUNIT_NUMBERS[i])) { if (bgc_fp32_is_unit(_TEST_FP32_NONUNIT_NUMBERS[i])) {
print_testing_error("A non-unit value was recognized as a unit value"); print_testing_error("A non-unit value was recognized as a unit value");
return; return;
} }
@ -50,24 +50,24 @@ static const int _TEST_FP64_NONUNIT_NUMBERS_AMOUNT = 4;
static const double _TEST_FP64_UNIT_NUMBERS[] = { static const double _TEST_FP64_UNIT_NUMBERS[] = {
1.0, 1.0,
1.0 + 0.75 * BGC_EPSYLON_FP64, 1.0 + 0.75 * BGC_FP64_EPSYLON,
1.0 - 0.75 * BGC_EPSYLON_FP64 1.0 - 0.75 * BGC_FP64_EPSYLON
}; };
static const double _TEST_FP64_NONUNIT_NUMBERS[] = { static const double _TEST_FP64_NONUNIT_NUMBERS[] = {
0.0, 0.0,
-1.0, -1.0,
1.0 + 1.25 * BGC_EPSYLON_FP64, 1.0 + 1.25 * BGC_FP64_EPSYLON,
1.0 - 1.25 * BGC_EPSYLON_FP64 1.0 - 1.25 * BGC_FP64_EPSYLON
}; };
void test_is_unit_fp64() void test_is_unit_fp64()
{ {
print_testing_name("bgc_is_unit_fp64"); print_testing_name("bgc_fp64_is_unit");
// Testing unit values: // Testing unit values:
for (int i = 0; i < _TEST_FP64_UNIT_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_UNIT_NUMBERS_AMOUNT; i++) {
if (!bgc_is_unit_fp64(_TEST_FP64_UNIT_NUMBERS[i])) { if (!bgc_fp64_is_unit(_TEST_FP64_UNIT_NUMBERS[i])) {
print_testing_error("A unit value was not recognized"); print_testing_error("A unit value was not recognized");
return; return;
} }
@ -75,7 +75,7 @@ void test_is_unit_fp64()
// Testing non-unit values: // Testing non-unit values:
for (int i = 0; i < _TEST_FP64_NONUNIT_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONUNIT_NUMBERS_AMOUNT; i++) {
if (bgc_is_unit_fp64(_TEST_FP64_NONUNIT_NUMBERS[i])) { if (bgc_fp64_is_unit(_TEST_FP64_NONUNIT_NUMBERS[i])) {
print_testing_error("A non-unit value was recognized as a unit value"); print_testing_error("A non-unit value was recognized as a unit value");
return; return;
} }
@ -91,24 +91,24 @@ static const int _TEST_FP32_DATA_SQUARE_NONUNIT_AMOUNT = 4;
static const float _TEST_FP32_DATA_SQUARE_UNIT[] = { static const float _TEST_FP32_DATA_SQUARE_UNIT[] = {
1.0f, 1.0f,
1.0f + 1.75f * BGC_EPSYLON_FP32, 1.0f + 1.75f * BGC_FP32_EPSYLON,
1.0f - 1.75f * BGC_EPSYLON_FP32 1.0f - 1.75f * BGC_FP32_EPSYLON
}; };
static const float _TEST_FP32_DATA_SQUARE_NONUNIT[] = { static const float _TEST_FP32_DATA_SQUARE_NONUNIT[] = {
0.0f, 0.0f,
-1.0f, -1.0f,
1.0f + 2.25f * BGC_EPSYLON_FP32, 1.0f + 2.25f * BGC_FP32_EPSYLON,
1.0f - 2.25f * BGC_EPSYLON_FP32 1.0f - 2.25f * BGC_FP32_EPSYLON
}; };
void test_is_sqare_unit_fp32() void test_is_square_unit_fp32()
{ {
print_testing_name("bgc_is_sqare_unit_fp32"); print_testing_name("bgc_fp32_is_square_unit");
// Testing unit values: // Testing unit values:
for (int i = 0; i < _TEST_FP32_DATA_SQUARE_UNIT_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_DATA_SQUARE_UNIT_AMOUNT; i++) {
if (!bgc_is_sqare_unit_fp32(_TEST_FP32_DATA_SQUARE_UNIT[i])) { if (!bgc_fp32_is_square_unit(_TEST_FP32_DATA_SQUARE_UNIT[i])) {
print_testing_error("A square unit value was not recognized"); print_testing_error("A square unit value was not recognized");
return; return;
} }
@ -116,7 +116,7 @@ void test_is_sqare_unit_fp32()
// Testing non-unit values: // Testing non-unit values:
for (int i = 0; i < _TEST_FP32_DATA_SQUARE_NONUNIT_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_DATA_SQUARE_NONUNIT_AMOUNT; i++) {
if (bgc_is_sqare_unit_fp32(_TEST_FP32_DATA_SQUARE_NONUNIT[i])) { if (bgc_fp32_is_square_unit(_TEST_FP32_DATA_SQUARE_NONUNIT[i])) {
print_testing_error("A non-unit value was recognized as a square unit value"); print_testing_error("A non-unit value was recognized as a square unit value");
return; return;
} }
@ -132,24 +132,24 @@ static const int _TEST_FP64_DATA_SQUARE_NONUNIT_AMOUNT = 4;
static const double _TEST_FP64_DATA_SQUARE_UNIT[] = { static const double _TEST_FP64_DATA_SQUARE_UNIT[] = {
1.0, 1.0,
1.0 + 1.75 * BGC_EPSYLON_FP64, 1.0 + 1.75 * BGC_FP64_EPSYLON,
1.0 - 1.75 * BGC_EPSYLON_FP64 1.0 - 1.75 * BGC_FP64_EPSYLON
}; };
static const double _TEST_FP64_DATA_SQUARE_NONUNIT[] = { static const double _TEST_FP64_DATA_SQUARE_NONUNIT[] = {
0.0, 0.0,
-1.0, -1.0,
1.0 + 2.25 * BGC_EPSYLON_FP64, 1.0 + 2.25 * BGC_FP64_EPSYLON,
1.0 - 2.25 * BGC_EPSYLON_FP64 1.0 - 2.25 * BGC_FP64_EPSYLON
}; };
void test_is_sqare_unit_fp64() void test_is_square_unit_fp64()
{ {
print_testing_name("bgc_is_sqare_unit_fp64"); print_testing_name("bgc_fp64_is_square_unit");
// Testing unit values: // Testing unit values:
for (int i = 0; i < _TEST_FP64_DATA_SQUARE_UNIT_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_DATA_SQUARE_UNIT_AMOUNT; i++) {
if (!bgc_is_sqare_unit_fp64(_TEST_FP64_DATA_SQUARE_UNIT[i])) { if (!bgc_fp64_is_square_unit(_TEST_FP64_DATA_SQUARE_UNIT[i])) {
print_testing_error("A square unit value was not recognized"); print_testing_error("A square unit value was not recognized");
return; return;
} }
@ -157,7 +157,7 @@ void test_is_sqare_unit_fp64()
// Testing non-unit values: // Testing non-unit values:
for (int i = 0; i < _TEST_FP64_DATA_SQUARE_NONUNIT_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_DATA_SQUARE_NONUNIT_AMOUNT; i++) {
if (bgc_is_sqare_unit_fp64(_TEST_FP64_DATA_SQUARE_NONUNIT[i])) { if (bgc_fp64_is_square_unit(_TEST_FP64_DATA_SQUARE_NONUNIT[i])) {
print_testing_error("A non-unit value was recognized as a square unit value"); print_testing_error("A non-unit value was recognized as a square unit value");
return; return;
} }
@ -171,6 +171,6 @@ void test_is_unit()
test_is_unit_fp32(); test_is_unit_fp32();
test_is_unit_fp64(); test_is_unit_fp64();
test_is_sqare_unit_fp32(); test_is_square_unit_fp32();
test_is_sqare_unit_fp64(); test_is_square_unit_fp64();
} }

View file

@ -5,9 +5,9 @@ void test_is_unit_fp32();
void test_is_unit_fp64(); void test_is_unit_fp64();
void test_is_sqare_unit_fp32(); void test_is_square_unit_fp32();
void test_is_sqare_unit_fp64(); void test_is_square_unit_fp64();
void test_is_unit(); void test_is_unit();

View file

@ -9,24 +9,24 @@ static const int _TEST_FP32_NONZERO_NUMBERS_AMOUNT = 4;
static const float _TEST_FP32_ZERO_NUMBERS[] = { static const float _TEST_FP32_ZERO_NUMBERS[] = {
0.0f, 0.0f,
0.75f * BGC_EPSYLON_FP32, 0.75f * BGC_FP32_EPSYLON,
-0.75f * BGC_EPSYLON_FP32 -0.75f * BGC_FP32_EPSYLON
}; };
static const float _TEST_FP32_NONZERO_NUMBERS[] = { static const float _TEST_FP32_NONZERO_NUMBERS[] = {
1.0f, 1.0f,
-1.0f, -1.0f,
1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_FP32_EPSYLON,
-1.25f * BGC_EPSYLON_FP32 -1.25f * BGC_FP32_EPSYLON
}; };
void test_is_zero_fp32() void test_is_zero_fp32()
{ {
print_testing_name("bgc_is_zero_fp32"); print_testing_name("bgc_fp32_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_ZERO_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_ZERO_NUMBERS_AMOUNT; i++) {
if (!bgc_is_zero_fp32(_TEST_FP32_ZERO_NUMBERS[i])) { if (!bgc_fp32_is_zero(_TEST_FP32_ZERO_NUMBERS[i])) {
print_testing_error("A zero value was not recognized"); print_testing_error("A zero value was not recognized");
return; return;
} }
@ -34,7 +34,7 @@ void test_is_zero_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONZERO_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONZERO_NUMBERS_AMOUNT; i++) {
if (bgc_is_zero_fp32(_TEST_FP32_NONZERO_NUMBERS[i])) { if (bgc_fp32_is_zero(_TEST_FP32_NONZERO_NUMBERS[i])) {
print_testing_error("A non-zero value was recognized as a zero value"); print_testing_error("A non-zero value was recognized as a zero value");
return; return;
} }
@ -50,24 +50,24 @@ static const int _TEST_FP64_NONZERO_NUMBERS_AMOUNT = 4;
static const double _TEST_FP64_ZERO_NUMBERS[] = { static const double _TEST_FP64_ZERO_NUMBERS[] = {
0.0, 0.0,
0.75 * BGC_EPSYLON_FP64, 0.75 * BGC_FP64_EPSYLON,
-0.75 * BGC_EPSYLON_FP64 -0.75 * BGC_FP64_EPSYLON
}; };
static const double _TEST_FP64_NONZERO_NUMBERS[] = { static const double _TEST_FP64_NONZERO_NUMBERS[] = {
1.0, 1.0,
-1.0, -1.0,
1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_FP64_EPSYLON,
-1.25 * BGC_EPSYLON_FP64 -1.25 * BGC_FP64_EPSYLON
}; };
void test_is_zero_fp64() void test_is_zero_fp64()
{ {
print_testing_name("bgc_is_zero_fp64"); print_testing_name("bgc_fp64_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_ZERO_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_ZERO_NUMBERS_AMOUNT; i++) {
if (!bgc_is_zero_fp64(_TEST_FP64_ZERO_NUMBERS[i])) { if (!bgc_fp64_is_zero(_TEST_FP64_ZERO_NUMBERS[i])) {
print_testing_error("A zero value was not recognized"); print_testing_error("A zero value was not recognized");
return; return;
} }
@ -75,7 +75,7 @@ void test_is_zero_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONZERO_NUMBERS_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONZERO_NUMBERS_AMOUNT; i++) {
if (bgc_is_zero_fp64(_TEST_FP64_NONZERO_NUMBERS[i])) { if (bgc_fp64_is_zero(_TEST_FP64_NONZERO_NUMBERS[i])) {
print_testing_error("A non-zero value was recognized as a zero value"); print_testing_error("A non-zero value was recognized as a zero value");
return; return;
} }

View file

@ -22,7 +22,7 @@ void test_vector2()
const int TEST_FP32_VECTOR2_AMOUNT_1 = 5; const int TEST_FP32_VECTOR2_AMOUNT_1 = 5;
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1[] = { const BGC_FP32_Vector2 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 },
@ -30,7 +30,7 @@ const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1[] = {
{ -123.5f, 3.7283f } { -123.5f, 3.7283f }
}; };
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_2[] = { const BGC_FP32_Vector2 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 },
@ -49,7 +49,7 @@ 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 = bgc_vector2_get_square_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]); square_modulus = bgc_fp32_vector2_get_square_modulus(&TEST_FP32_VECTOR2_COMMON_1[i]);
if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_SQUARE_MODULUS_1[i])) { if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_SQUARE_MODULUS_1[i])) {
print_testing_failed(); print_testing_failed();
@ -72,7 +72,7 @@ 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 = bgc_vector2_get_modulus_fp32(&TEST_FP32_VECTOR2_COMMON_1[i]); square_modulus = bgc_fp32_vector2_get_modulus(&TEST_FP32_VECTOR2_COMMON_1[i]);
if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_MODULUS_1[i])) { if (!test_are_equal_fp32(square_modulus, FP32_VECTOR2_MODULUS_1[i])) {
print_testing_failed(); print_testing_failed();
@ -86,7 +86,7 @@ int test_vector2_fp32_modulus()
// ===================== Add ==================== // // ===================== Add ==================== //
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1_2_SUM[] = { const BGC_FP32_Vector2 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 },
@ -98,10 +98,10 @@ int test_vector2_add_fp32()
{ {
print_testing_name("vector2_fp32_t add"); print_testing_name("vector2_fp32_t add");
BgcVector2FP32 vector; BGC_FP32_Vector2 vector;
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) { for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
bgc_vector2_add_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector); bgc_fp32_vector2_add(&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) || if (!test_are_equal_fp32(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x1) ||
!test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x2)) { !test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_SUM[i].x2)) {
@ -116,7 +116,7 @@ int test_vector2_add_fp32()
// ================== Subtract ================== // // ================== Subtract ================== //
const BgcVector2FP32 TEST_FP32_VECTOR2_COMMON_1_2_DIFF[] = { const BGC_FP32_Vector2 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 },
@ -128,10 +128,10 @@ int test_vector2_subtract_fp32()
{ {
print_testing_name("vector2_fp32_t subtract"); print_testing_name("vector2_fp32_t subtract");
BgcVector2FP32 vector; BGC_FP32_Vector2 vector;
for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) { for (int i = 0; i < TEST_FP32_VECTOR2_AMOUNT_1; i++) {
bgc_vector2_subtract_fp32(&TEST_FP32_VECTOR2_COMMON_1[i], &TEST_FP32_VECTOR2_COMMON_2[i], &vector); bgc_fp32_vector2_subtract(&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) || if (!test_are_equal_fp32(vector.x1, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x1) ||
!test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x2)) { !test_are_equal_fp32(vector.x2, TEST_FP32_VECTOR2_COMMON_1_2_DIFF[i].x2)) {

View file

@ -7,7 +7,7 @@
// ==================== FP32 ==================== // // ==================== FP32 ==================== //
static const int _TEST_FP32_VECTOR2_AMOUNT = 4; static const int _TEST_FP32_VECTOR2_AMOUNT = 4;
static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST[] = { static const BGC_FP32_Vector2 _TEST_FP32_VECTOR2_LIST[] = {
{ 1.0f, 2.0f }, { 1.0f, 2.0f },
{ -2.0f, -1.0f }, { -2.0f, -1.0f },
{ 100.0f, -100.0f }, { 100.0f, -100.0f },
@ -16,13 +16,13 @@ static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST[] = {
void test_vector2_copy_fp32() void test_vector2_copy_fp32()
{ {
BgcVector2FP32 vector; BGC_FP32_Vector2 vector;
print_testing_name("bgc_vector2_copy_fp32"); print_testing_name("bgc_fp32_vector2_copy");
for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
bgc_vector2_copy_fp32(&_TEST_FP32_VECTOR2_LIST[i], &vector); bgc_fp32_vector2_copy(&_TEST_FP32_VECTOR2_LIST[i], &vector);
if (vector.x1 != _TEST_FP32_VECTOR2_LIST[i].x1 || vector.x2 != _TEST_FP32_VECTOR2_LIST[i].x2) { if (vector.x1 != _TEST_FP32_VECTOR2_LIST[i].x1 || vector.x2 != _TEST_FP32_VECTOR2_LIST[i].x2) {
print_testing_failed(); print_testing_failed();
@ -36,7 +36,7 @@ void test_vector2_copy_fp32()
// ==================== FP64 ==================== // // ==================== FP64 ==================== //
static const int _TEST_FP64_VECTOR2_AMOUNT = 4; static const int _TEST_FP64_VECTOR2_AMOUNT = 4;
static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST[] = { static const BGC_FP64_Vector2 _TEST_FP64_VECTOR2_LIST[] = {
{ 1.0, 2.0 }, { 1.0, 2.0 },
{ -2.0, -1.0 }, { -2.0, -1.0 },
{ 100.0, -100.0 }, { 100.0, -100.0 },
@ -45,13 +45,13 @@ static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST[] = {
void test_vector2_copy_fp64() void test_vector2_copy_fp64()
{ {
BgcVector2FP64 vector; BGC_FP64_Vector2 vector;
print_testing_name("bgc_vector2_copy_fp64"); print_testing_name("bgc_fp64_vector2_copy");
for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
bgc_vector2_copy_fp64(&_TEST_FP64_VECTOR2_LIST[i], &vector); bgc_fp64_vector2_copy(&_TEST_FP64_VECTOR2_LIST[i], &vector);
if (vector.x1 != _TEST_FP64_VECTOR2_LIST[i].x1 || vector.x2 != _TEST_FP64_VECTOR2_LIST[i].x2) { if (vector.x1 != _TEST_FP64_VECTOR2_LIST[i].x1 || vector.x2 != _TEST_FP64_VECTOR2_LIST[i].x2) {
print_testing_failed(); print_testing_failed();

View file

@ -7,32 +7,32 @@
static const int _TEST_FP32_UNIT_VECTOR2_AMOUNT = 6; static const int _TEST_FP32_UNIT_VECTOR2_AMOUNT = 6;
static const int _TEST_FP32_NONUNIT_VECTOR2_AMOUNT = 7; static const int _TEST_FP32_NONUNIT_VECTOR2_AMOUNT = 7;
static const BgcVector2FP32 _TEST_FP32_UNIT_VECTOR2_LIST[] = { static const BGC_FP32_Vector2 _TEST_FP32_UNIT_VECTOR2_LIST[] = {
{ 1.0f, 0.0f }, { 1.0f, 0.0f },
{ 0.0f, -1.0f }, { 0.0f, -1.0f },
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 } { 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcVector2FP32 _TEST_FP32_NONUNIT_VECTOR2_LIST[] = { static const BGC_FP32_Vector2 _TEST_FP32_NONUNIT_VECTOR2_LIST[] = {
{ 0.0f, 0.0f }, { 0.0f, 0.0f },
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON },
{ 0.8f + 1.25f * BGC_EPSYLON_FP32, 0.6f + 1.25f * BGC_EPSYLON_FP32 }, { 0.8f + 1.25f * BGC_FP32_EPSYLON, 0.6f + 1.25f * BGC_FP32_EPSYLON },
{ 0.6f - 1.25f * BGC_EPSYLON_FP32, 0.8f - 1.25f * BGC_EPSYLON_FP32 } { 0.6f - 1.25f * BGC_FP32_EPSYLON, 0.8f - 1.25f * BGC_FP32_EPSYLON }
}; };
void test_vector2_is_unit_fp32() void test_vector2_is_unit_fp32()
{ {
print_testing_name("bgc_vector2_is_unit_fp32"); print_testing_name("bgc_fp32_vector2_is_unit");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_UNIT_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_UNIT_VECTOR2_AMOUNT; i++) {
if (!bgc_vector2_is_unit_fp32(&_TEST_FP32_UNIT_VECTOR2_LIST[i])) { if (!bgc_fp32_vector2_is_unit(&_TEST_FP32_UNIT_VECTOR2_LIST[i])) {
print_testing_error("A unit vector was not recognized"); print_testing_error("A unit vector was not recognized");
return; return;
} }
@ -40,7 +40,7 @@ void test_vector2_is_unit_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR2_AMOUNT; i++) {
if (bgc_vector2_is_unit_fp32(&_TEST_FP32_NONUNIT_VECTOR2_LIST[i])) { if (bgc_fp32_vector2_is_unit(&_TEST_FP32_NONUNIT_VECTOR2_LIST[i])) {
print_testing_error("A non-unit vector was recognized as a unit vector"); print_testing_error("A non-unit vector was recognized as a unit vector");
return; return;
} }
@ -54,32 +54,32 @@ void test_vector2_is_unit_fp32()
static const int _TEST_FP64_UNIT_VECTOR2_AMOUNT = 6; static const int _TEST_FP64_UNIT_VECTOR2_AMOUNT = 6;
static const int _TEST_FP64_NONUNIT_VECTOR2_AMOUNT = 7; static const int _TEST_FP64_NONUNIT_VECTOR2_AMOUNT = 7;
static const BgcVector2FP64 _TEST_FP64_UNIT_VECTOR2_LIST[] = { static const BGC_FP64_Vector2 _TEST_FP64_UNIT_VECTOR2_LIST[] = {
{ -1.0, 0.0 }, { -1.0, 0.0 },
{ 0.0, 1.0 }, { 0.0, 1.0 },
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON },
{ 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 } { 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcVector2FP64 _TEST_FP64_NONUNIT_VECTOR2_LIST[] = { static const BGC_FP64_Vector2 _TEST_FP64_NONUNIT_VECTOR2_LIST[] = {
{ 0.0, 0.0 }, { 0.0, 0.0 },
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON },
{ 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON },
{ 0.6 + 1.25 * BGC_EPSYLON_FP64, 0.8 + 1.25 * BGC_EPSYLON_FP64 }, { 0.6 + 1.25 * BGC_FP64_EPSYLON, 0.8 + 1.25 * BGC_FP64_EPSYLON },
{ 0.8 - 1.25 * BGC_EPSYLON_FP64, 0.6 - 1.25 * BGC_EPSYLON_FP64 } { 0.8 - 1.25 * BGC_FP64_EPSYLON, 0.6 - 1.25 * BGC_FP64_EPSYLON }
}; };
void test_vector2_is_unit_fp64() void test_vector2_is_unit_fp64()
{ {
print_testing_name("bgc_vector2_is_unit_fp64"); print_testing_name("bgc_fp64_vector2_is_unit");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_UNIT_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_UNIT_VECTOR2_AMOUNT; i++) {
if (!bgc_vector2_is_unit_fp64(&_TEST_FP64_UNIT_VECTOR2_LIST[i])) { if (!bgc_fp64_vector2_is_unit(&_TEST_FP64_UNIT_VECTOR2_LIST[i])) {
print_testing_error("A unit vector was not recognized"); print_testing_error("A unit vector was not recognized");
return; return;
} }
@ -87,7 +87,7 @@ void test_vector2_is_unit_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONUNIT_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONUNIT_VECTOR2_AMOUNT; i++) {
if (bgc_vector2_is_unit_fp64(&_TEST_FP64_NONUNIT_VECTOR2_LIST[i])) { if (bgc_fp64_vector2_is_unit(&_TEST_FP64_NONUNIT_VECTOR2_LIST[i])) {
print_testing_error("A non-unit vector was recognized as a unit vector"); print_testing_error("A non-unit vector was recognized as a unit vector");
return; return;
} }

View file

@ -7,31 +7,31 @@
static const int _TEST_FP32_ZERO_VECTOR2_AMOUNT = 5; static const int _TEST_FP32_ZERO_VECTOR2_AMOUNT = 5;
static const int _TEST_FP32_NONZERO_VECTOR2_AMOUNT = 7; static const int _TEST_FP32_NONZERO_VECTOR2_AMOUNT = 7;
static const BgcVector2FP32 _TEST_FP32_ZERO_VECTOR2_LIST[] = { static const BGC_FP32_Vector2 _TEST_FP32_ZERO_VECTOR2_LIST[] = {
{ 0.0f, 0.0f }, { 0.0f, 0.0f },
{ 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ -0.75f * BGC_EPSYLON_FP32, 0.0f }, { -0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, -0.75f * BGC_EPSYLON_FP32 } { 0.0f, -0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcVector2FP32 _TEST_FP32_NONZERO_VECTOR2_LIST[] = { static const BGC_FP32_Vector2 _TEST_FP32_NONZERO_VECTOR2_LIST[] = {
{ 0.0f, 1.0f }, { 0.0f, 1.0f },
{ 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ -1.25f * BGC_EPSYLON_FP32, 0.0f }, { -1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, -1.25f * BGC_EPSYLON_FP32 }, { 0.0f, -1.25f * BGC_FP32_EPSYLON },
{ 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32 }, { 1.25f * BGC_FP32_EPSYLON, 1.25f * BGC_FP32_EPSYLON },
{ -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32 } { -1.25f * BGC_FP32_EPSYLON, -1.25f * BGC_FP32_EPSYLON }
}; };
void test_vector2_is_zero_fp32() void test_vector2_is_zero_fp32()
{ {
print_testing_name("bgc_vector2_is_zero_fp32"); print_testing_name("bgc_fp32_vector2_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_ZERO_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_ZERO_VECTOR2_AMOUNT; i++) {
if (!bgc_vector2_is_zero_fp32(&_TEST_FP32_ZERO_VECTOR2_LIST[i])) { if (!bgc_fp32_vector2_is_zero(&_TEST_FP32_ZERO_VECTOR2_LIST[i])) {
print_testing_error("A zero vector was not recongized"); print_testing_error("A zero vector was not recongized");
return; return;
} }
@ -39,7 +39,7 @@ void test_vector2_is_zero_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONZERO_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONZERO_VECTOR2_AMOUNT; i++) {
if (bgc_vector2_is_zero_fp32(&_TEST_FP32_NONZERO_VECTOR2_LIST[i])) { if (bgc_fp32_vector2_is_zero(&_TEST_FP32_NONZERO_VECTOR2_LIST[i])) {
print_testing_error("A non-zero vector was recongized as a zero vector"); print_testing_error("A non-zero vector was recongized as a zero vector");
return; return;
} }
@ -53,31 +53,31 @@ void test_vector2_is_zero_fp32()
static const int _TEST_FP64_ZERO_VECTOR2_AMOUNT = 5; static const int _TEST_FP64_ZERO_VECTOR2_AMOUNT = 5;
static const int _TEST_FP64_NONZERO_VECTOR2_AMOUNT = 7; static const int _TEST_FP64_NONZERO_VECTOR2_AMOUNT = 7;
static const BgcVector2FP64 _TEST_FP64_ZERO_VECTOR2_LIST[] = { static const BGC_FP64_Vector2 _TEST_FP64_ZERO_VECTOR2_LIST[] = {
{ 0.0, 0.0 }, { 0.0, 0.0 },
{ 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ -0.75 * BGC_EPSYLON_FP64, 0.0 }, { -0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 0.75 * BGC_FP64_EPSYLON },
{ 0.0, -0.75 * BGC_EPSYLON_FP64 } { 0.0, -0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcVector2FP64 _TEST_FP64_NONZERO_VECTOR2_LIST[] = { static const BGC_FP64_Vector2 _TEST_FP64_NONZERO_VECTOR2_LIST[] = {
{ 0.0, 1.0 }, { 0.0, 1.0 },
{ 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ -1.25 * BGC_EPSYLON_FP64, 0.0 }, { -1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 1.25 * BGC_FP64_EPSYLON },
{ 0.0, -1.25 * BGC_EPSYLON_FP64 }, { 0.0, -1.25 * BGC_FP64_EPSYLON },
{ 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64 }, { 1.25 * BGC_FP64_EPSYLON, 1.25 * BGC_FP64_EPSYLON },
{ -1.25 * BGC_EPSYLON_FP64, -1.25 * BGC_EPSYLON_FP64 } { -1.25 * BGC_FP64_EPSYLON, -1.25 * BGC_FP64_EPSYLON }
}; };
void test_vector2_is_zero_fp64() void test_vector2_is_zero_fp64()
{ {
print_testing_name("bgc_vector2_is_zero_fp64"); print_testing_name("bgc_fp64_vector2_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_ZERO_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_ZERO_VECTOR2_AMOUNT; i++) {
if (!bgc_vector2_is_zero_fp64(&_TEST_FP64_ZERO_VECTOR2_LIST[i])) { if (!bgc_fp64_vector2_is_zero(&_TEST_FP64_ZERO_VECTOR2_LIST[i])) {
print_testing_error("A zero vector was not recongized"); print_testing_error("A zero vector was not recongized");
return; return;
} }
@ -85,7 +85,7 @@ void test_vector2_is_zero_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONZERO_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONZERO_VECTOR2_AMOUNT; i++) {
if (bgc_vector2_is_zero_fp64(&_TEST_FP64_NONZERO_VECTOR2_LIST[i])) { if (bgc_fp64_vector2_is_zero(&_TEST_FP64_NONZERO_VECTOR2_LIST[i])) {
print_testing_error("A non-zero vector was recongized as a zero vector"); print_testing_error("A non-zero vector was recongized as a zero vector");
return; return;
} }

View file

@ -6,7 +6,7 @@
static const int _TEST_FP32_VECTOR2_AMOUNT = 4; static const int _TEST_FP32_VECTOR2_AMOUNT = 4;
static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST[] = { static const BGC_FP32_Vector2 _TEST_FP32_VECTOR2_LIST[] = {
{ 4.0f, 3.0f }, { 4.0f, 3.0f },
{ -3.0f, -4.0f }, { -3.0f, -4.0f },
{ 100.0f, -100.0f }, { 100.0f, -100.0f },
@ -29,10 +29,10 @@ static const float _TEST_FP32_MODULUS_LIST[] = {
void test_vector2_square_modulus_fp32() void test_vector2_square_modulus_fp32()
{ {
print_testing_name("bgc_vector2_get_square_modulus_fp32"); print_testing_name("bgc_fp32_vector2_get_square_modulus");
for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_vector2_get_square_modulus_fp32(&_TEST_FP32_VECTOR2_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) { if (!bgc_fp32_are_close(bgc_fp32_vector2_get_square_modulus(&_TEST_FP32_VECTOR2_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -43,10 +43,10 @@ void test_vector2_square_modulus_fp32()
void test_vector2_modulus_fp32() void test_vector2_modulus_fp32()
{ {
print_testing_name("bgc_vector2_get_modulus_fp32"); print_testing_name("bgc_fp32_vector2_get_modulus");
for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_vector2_get_modulus_fp32(&_TEST_FP32_VECTOR2_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) { if (!bgc_fp32_are_close(bgc_fp32_vector2_get_modulus(&_TEST_FP32_VECTOR2_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -59,7 +59,7 @@ void test_vector2_modulus_fp32()
static const int _TEST_FP64_VECTOR2_AMOUNT = 4; static const int _TEST_FP64_VECTOR2_AMOUNT = 4;
static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST[] = { static const BGC_FP64_Vector2 _TEST_FP64_VECTOR2_LIST[] = {
{ 4.0, 3.0 }, { 4.0, 3.0 },
{ -3.0, -4.0 }, { -3.0, -4.0 },
{ 100.0, -100.0 }, { 100.0, -100.0 },
@ -82,10 +82,10 @@ static const double _TEST_FP64_MODULUS_LIST[] = {
void test_vector2_square_modulus_fp64() void test_vector2_square_modulus_fp64()
{ {
print_testing_name("bgc_vector2_get_square_modulus_fp64"); print_testing_name("bgc_fp64_vector2_get_square_modulus");
for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_vector2_get_square_modulus_fp64(&_TEST_FP64_VECTOR2_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) { if (!bgc_fp64_are_close(bgc_fp64_vector2_get_square_modulus(&_TEST_FP64_VECTOR2_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -96,10 +96,10 @@ void test_vector2_square_modulus_fp64()
void test_vector2_modulus_fp64() void test_vector2_modulus_fp64()
{ {
print_testing_name("bgc_vector2_get_modulus_fp64"); print_testing_name("bgc_fp64_vector2_get_modulus");
for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_vector2_get_modulus_fp64(&_TEST_FP64_VECTOR2_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) { if (!bgc_fp64_are_close(bgc_fp64_vector2_get_modulus(&_TEST_FP64_VECTOR2_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }

View file

@ -4,11 +4,11 @@
void test_vector2_reset_fp32() void test_vector2_reset_fp32()
{ {
BgcVector2FP32 vector; BGC_FP32_Vector2 vector;
print_testing_name("bgc_vector2_reset_fp32"); print_testing_name("bgc_fp32_vector2_reset");
bgc_vector2_reset_fp32(&vector); bgc_fp32_vector2_reset(&vector);
if (vector.x1 != 0.0f || vector.x2 != 0.0f) { if (vector.x1 != 0.0f || vector.x2 != 0.0f) {
print_testing_failed(); print_testing_failed();
@ -20,11 +20,11 @@ void test_vector2_reset_fp32()
void test_vector2_reset_fp64() void test_vector2_reset_fp64()
{ {
BgcVector2FP64 vector; BGC_FP64_Vector2 vector;
print_testing_name("bgc_vector2_reset_fp64"); print_testing_name("bgc_fp64_vector2_reset");
bgc_vector2_reset_fp64(&vector); bgc_fp64_vector2_reset(&vector);
if (vector.x1 != 0.0 || vector.x2 != 0.0) { if (vector.x1 != 0.0 || vector.x2 != 0.0) {
print_testing_failed(); print_testing_failed();

View file

@ -8,25 +8,25 @@
void test_vector2_set_values_fp32() void test_vector2_set_values_fp32()
{ {
BgcVector2FP32 vector; BGC_FP32_Vector2 vector;
print_testing_name("bgc_vector2_set_values_fp32"); print_testing_name("bgc_fp32_vector2_make");
bgc_vector2_set_values_fp32(1.0f, 2.0f, &vector); bgc_fp32_vector2_make(1.0f, 2.0f, &vector);
if (vector.x1 != 1.0f || vector.x2 != 2.0f) { if (vector.x1 != 1.0f || vector.x2 != 2.0f) {
print_testing_error("First step failed"); print_testing_error("First step failed");
return; return;
} }
bgc_vector2_set_values_fp32(-3.0f, -5.0f, &vector); bgc_fp32_vector2_make(-3.0f, -5.0f, &vector);
if (vector.x1 != -3.0f || vector.x2 != -5.0f) { if (vector.x1 != -3.0f || vector.x2 != -5.0f) {
print_testing_error("Second step failed"); print_testing_error("Second step failed");
return; return;
} }
bgc_vector2_set_values_fp32(-2.0f, 2.0f, &vector); bgc_fp32_vector2_make(-2.0f, 2.0f, &vector);
if (vector.x1 != -2.0f || vector.x2 != 2.0f) { if (vector.x1 != -2.0f || vector.x2 != 2.0f) {
print_testing_error("Third step failed"); print_testing_error("Third step failed");
@ -40,26 +40,26 @@ void test_vector2_set_values_fp32()
void test_vector2_set_values_fp64() void test_vector2_set_values_fp64()
{ {
BgcVector2FP64 vector; BGC_FP64_Vector2 vector;
print_testing_name("bgc_vector2_set_values_fp64"); print_testing_name("bgc_fp64_vector2_make");
bgc_vector2_set_values_fp64(1.0, 2.0, &vector); bgc_fp64_vector2_make(1.0, 2.0, &vector);
if (vector.x1 != 1.0 || vector.x2 != 2.0) { if (vector.x1 != 1.0 || vector.x2 != 2.0) {
print_testing_error("First step failed"); print_testing_error("First step failed");
return; return;
} }
bgc_vector2_set_values_fp64(-3.0, -5.0, &vector); bgc_fp64_vector2_make(-3.0, -5.0, &vector);
if (vector.x1 != -3.0 || vector.x2 != -5.0) { if (vector.x1 != -3.0 || vector.x2 != -5.0) {
print_testing_error("Second step failed"); print_testing_error("Second step failed");
return; return;
} }
bgc_vector2_set_values_fp64(-2.0, 2.0, &vector); bgc_fp64_vector2_make(-2.0, 2.0, &vector);
if (vector.x1 != -2.0 || vector.x2 != 2.0) { if (vector.x1 != -2.0 || vector.x2 != 2.0) {
print_testing_error("Third step failed"); print_testing_error("Third step failed");

View file

@ -8,14 +8,14 @@
static const int _TEST_FP32_VECTOR2_AMOUNT = 4; static const int _TEST_FP32_VECTOR2_AMOUNT = 4;
static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST1[] = { static const BGC_FP32_Vector2 _TEST_FP32_VECTOR2_LIST1[] = {
{ 1.0f, 2.0f }, { 1.0f, 2.0f },
{ -2.0f, -1.0f }, { -2.0f, -1.0f },
{ 100.0f, -100.0f }, { 100.0f, -100.0f },
{ -100.1f, 100.2f } { -100.1f, 100.2f }
}; };
static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST2[] = { static const BGC_FP32_Vector2 _TEST_FP32_VECTOR2_LIST2[] = {
{ 3.6f, 5.3f }, { 3.6f, 5.3f },
{ 204.07f, -781.89f }, { 204.07f, -781.89f },
{ -20.02f, -1.0003f }, { -20.02f, -1.0003f },
@ -24,15 +24,15 @@ static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST2[] = {
void test_vector2_swap_fp32() void test_vector2_swap_fp32()
{ {
BgcVector2FP32 vector1, vector2; BGC_FP32_Vector2 vector1, vector2;
print_testing_name("bgc_vector2_swap_fp32"); print_testing_name("bgc_fp32_vector2_swap");
for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VECTOR2_AMOUNT; i++) {
bgc_vector2_copy_fp32(&_TEST_FP32_VECTOR2_LIST1[i], &vector1); bgc_fp32_vector2_copy(&_TEST_FP32_VECTOR2_LIST1[i], &vector1);
bgc_vector2_copy_fp32(&_TEST_FP32_VECTOR2_LIST2[i], &vector2); bgc_fp32_vector2_copy(&_TEST_FP32_VECTOR2_LIST2[i], &vector2);
bgc_vector2_swap_fp32(&vector1, &vector2); bgc_fp32_vector2_swap(&vector1, &vector2);
if (vector1.x1 != _TEST_FP32_VECTOR2_LIST2[i].x1 || if (vector1.x1 != _TEST_FP32_VECTOR2_LIST2[i].x1 ||
vector1.x2 != _TEST_FP32_VECTOR2_LIST2[i].x2 || vector1.x2 != _TEST_FP32_VECTOR2_LIST2[i].x2 ||
@ -50,14 +50,14 @@ void test_vector2_swap_fp32()
static const int _TEST_FP64_VECTOR2_AMOUNT = 4; static const int _TEST_FP64_VECTOR2_AMOUNT = 4;
static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST1[] = { static const BGC_FP64_Vector2 _TEST_FP64_VECTOR2_LIST1[] = {
{ 1.0, 2.0 }, { 1.0, 2.0 },
{ -2.0, -1.0 }, { -2.0, -1.0 },
{ 100.0, -100.0 }, { 100.0, -100.0 },
{ -100.1, 100.2 } { -100.1, 100.2 }
}; };
static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST2[] = { static const BGC_FP64_Vector2 _TEST_FP64_VECTOR2_LIST2[] = {
{ 3.6, 5.3 }, { 3.6, 5.3 },
{ 204.07, -781.89 }, { 204.07, -781.89 },
{ -20.02, -1.0003 }, { -20.02, -1.0003 },
@ -66,15 +66,15 @@ static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST2[] = {
void test_vector2_swap_fp64() void test_vector2_swap_fp64()
{ {
BgcVector2FP64 vector1, vector2; BGC_FP64_Vector2 vector1, vector2;
print_testing_name("bgc_vector2_swap_fp64"); print_testing_name("bgc_fp64_vector2_swap");
for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VECTOR2_AMOUNT; i++) {
bgc_vector2_copy_fp64(&_TEST_FP64_VECTOR2_LIST1[i], &vector1); bgc_fp64_vector2_copy(&_TEST_FP64_VECTOR2_LIST1[i], &vector1);
bgc_vector2_copy_fp64(&_TEST_FP64_VECTOR2_LIST2[i], &vector2); bgc_fp64_vector2_copy(&_TEST_FP64_VECTOR2_LIST2[i], &vector2);
bgc_vector2_swap_fp64(&vector1, &vector2); bgc_fp64_vector2_swap(&vector1, &vector2);
if (vector1.x1 != _TEST_FP64_VECTOR2_LIST2[i].x1 || if (vector1.x1 != _TEST_FP64_VECTOR2_LIST2[i].x1 ||
vector1.x2 != _TEST_FP64_VECTOR2_LIST2[i].x2 || vector1.x2 != _TEST_FP64_VECTOR2_LIST2[i].x2 ||

View file

@ -7,7 +7,7 @@
// ==================== FP32 ==================== // // ==================== FP32 ==================== //
static const int _TEST_FP32_VECTOR3_AMOUNT = 4; static const int _TEST_FP32_VECTOR3_AMOUNT = 4;
static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = { static const BGC_FP32_Vector3 _TEST_FP32_VECTOR3_LIST[] = {
{ 1.0f, 2.0f, 3.0f }, { 1.0f, 2.0f, 3.0f },
{ -3.0f, -2.0f, -1.0f }, { -3.0f, -2.0f, -1.0f },
{ 100.0f, -100.0f, 0.001f }, { 100.0f, -100.0f, 0.001f },
@ -16,13 +16,13 @@ static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = {
void test_vector3_copy_fp32() void test_vector3_copy_fp32()
{ {
BgcVector3FP32 vector; BGC_FP32_Vector3 vector;
print_testing_name("bgc_vector3_copy_fp32"); print_testing_name("bgc_fp32_vector3_copy");
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST[i], &vector); bgc_fp32_vector3_copy(&_TEST_FP32_VECTOR3_LIST[i], &vector);
if (vector.x1 != _TEST_FP32_VECTOR3_LIST[i].x1 || if (vector.x1 != _TEST_FP32_VECTOR3_LIST[i].x1 ||
vector.x2 != _TEST_FP32_VECTOR3_LIST[i].x2 || vector.x2 != _TEST_FP32_VECTOR3_LIST[i].x2 ||
@ -38,7 +38,7 @@ void test_vector3_copy_fp32()
// ==================== FP64 ==================== // // ==================== FP64 ==================== //
static const int _TEST_FP64_VECTOR3_AMOUNT = 4; static const int _TEST_FP64_VECTOR3_AMOUNT = 4;
static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = { static const BGC_FP64_Vector3 _TEST_FP64_VECTOR3_LIST[] = {
{ 1.0, 2.0, 3.0 }, { 1.0, 2.0, 3.0 },
{ -3.0, -2.0, -1.0 }, { -3.0, -2.0, -1.0 },
{ 100.0, -100.0, 0.001 }, { 100.0, -100.0, 0.001 },
@ -47,13 +47,13 @@ static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = {
void test_vector3_copy_fp64() void test_vector3_copy_fp64()
{ {
BgcVector3FP64 vector; BGC_FP64_Vector3 vector;
print_testing_name("bgc_vector3_copy_fp64"); print_testing_name("bgc_fp64_vector3_copy");
for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST[i], &vector); bgc_fp64_vector3_copy(&_TEST_FP64_VECTOR3_LIST[i], &vector);
if (vector.x1 != _TEST_FP64_VECTOR3_LIST[i].x1 || if (vector.x1 != _TEST_FP64_VECTOR3_LIST[i].x1 ||
vector.x2 != _TEST_FP64_VECTOR3_LIST[i].x2 || vector.x2 != _TEST_FP64_VECTOR3_LIST[i].x2 ||

View file

@ -7,38 +7,38 @@
static const int _TEST_FP32_UNIT_VECTOR3_AMOUNT = 10; static const int _TEST_FP32_UNIT_VECTOR3_AMOUNT = 10;
static const int _TEST_FP32_NONUNIT_VECTOR3_AMOUNT = 9; static const int _TEST_FP32_NONUNIT_VECTOR3_AMOUNT = 9;
static const BgcVector3FP32 _TEST_FP32_UNIT_VECTOR3_LIST[] = { static const BGC_FP32_Vector3 _TEST_FP32_UNIT_VECTOR3_LIST[] = {
{ 1.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f },
{ 0.0f, -1.0f, 0.0f }, { 0.0f, -1.0f, 0.0f },
{ 0.0f, -0.8f, 0.6f }, { 0.0f, -0.8f, 0.6f },
{ -0.6f, 0.0f, 0.8f }, { -0.6f, 0.0f, 0.8f },
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, -1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, -1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, -1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, -1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 } { 0.0f, 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcVector3FP32 _TEST_FP32_NONUNIT_VECTOR3_LIST[] = { static const BGC_FP32_Vector3 _TEST_FP32_NONUNIT_VECTOR3_LIST[] = {
{ 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f },
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON },
{ 0.8f + 1.25f * BGC_EPSYLON_FP32, -0.6f - 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.8f + 1.25f * BGC_FP32_EPSYLON, -0.6f - 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.6f - 1.25f * BGC_EPSYLON_FP32, -0.8f + 1.25f * BGC_EPSYLON_FP32, 0.0f } { 0.6f - 1.25f * BGC_FP32_EPSYLON, -0.8f + 1.25f * BGC_FP32_EPSYLON, 0.0f }
}; };
void test_vector3_is_unit_fp32() void test_vector3_is_unit_fp32()
{ {
print_testing_name("bgc_vector3_is_unit_fp32"); print_testing_name("bgc_fp32_vector3_is_unit");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_UNIT_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_UNIT_VECTOR3_AMOUNT; i++) {
if (!bgc_vector3_is_unit_fp32(&_TEST_FP32_UNIT_VECTOR3_LIST[i])) { if (!bgc_fp32_vector3_is_unit(&_TEST_FP32_UNIT_VECTOR3_LIST[i])) {
print_testing_error("A unit vector was not recognized"); print_testing_error("A unit vector was not recognized");
return; return;
} }
@ -46,7 +46,7 @@ void test_vector3_is_unit_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR3_AMOUNT; i++) {
if (bgc_vector3_is_unit_fp32(&_TEST_FP32_NONUNIT_VECTOR3_LIST[i])) { if (bgc_fp32_vector3_is_unit(&_TEST_FP32_NONUNIT_VECTOR3_LIST[i])) {
print_testing_error("A non-unit vector was recognized as a unit vector"); print_testing_error("A non-unit vector was recognized as a unit vector");
return; return;
} }
@ -60,38 +60,38 @@ void test_vector3_is_unit_fp32()
static const int _TEST_FP64_UNIT_VECTOR3_AMOUNT = 10; static const int _TEST_FP64_UNIT_VECTOR3_AMOUNT = 10;
static const int _TEST_FP64_NONUNIT_VECTOR3_AMOUNT = 9; static const int _TEST_FP64_NONUNIT_VECTOR3_AMOUNT = 9;
static const BgcVector3FP64 _TEST_FP64_UNIT_VECTOR3_LIST[] = { static const BGC_FP64_Vector3 _TEST_FP64_UNIT_VECTOR3_LIST[] = {
{ 1.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0 },
{ 0.0, -1.0, 0.0 }, { 0.0, -1.0, 0.0 },
{ 0.0, -0.8, 0.6 }, { 0.0, -0.8, 0.6 },
{ -0.6, 0.0, 0.8 }, { -0.6, 0.0, 0.8 },
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, -1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, -1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, -1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, -1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 } { 0.0, 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcVector3FP64 _TEST_FP64_NONUNIT_VECTOR3_LIST[] = { static const BGC_FP64_Vector3 _TEST_FP64_NONUNIT_VECTOR3_LIST[] = {
{ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 },
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON },
{ 0.8 + 1.25 * BGC_EPSYLON_FP64, -0.6 - 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.8 + 1.25 * BGC_FP64_EPSYLON, -0.6 - 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.6 - 1.25 * BGC_EPSYLON_FP64, -0.8 + 1.25 * BGC_EPSYLON_FP64, 0.0 } { 0.6 - 1.25 * BGC_FP64_EPSYLON, -0.8 + 1.25 * BGC_FP64_EPSYLON, 0.0 }
}; };
void test_vector3_is_unit_fp64() void test_vector3_is_unit_fp64()
{ {
print_testing_name("bgc_vector3_is_unit_fp64"); print_testing_name("bgc_fp64_vector3_is_unit");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_UNIT_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_UNIT_VECTOR3_AMOUNT; i++) {
if (!bgc_vector3_is_unit_fp64(&_TEST_FP64_UNIT_VECTOR3_LIST[i])) { if (!bgc_fp64_vector3_is_unit(&_TEST_FP64_UNIT_VECTOR3_LIST[i])) {
print_testing_error("A unit vector was not recognized"); print_testing_error("A unit vector was not recognized");
return; return;
} }
@ -99,7 +99,7 @@ void test_vector3_is_unit_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONUNIT_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONUNIT_VECTOR3_AMOUNT; i++) {
if (bgc_vector3_is_unit_fp64(&_TEST_FP64_NONUNIT_VECTOR3_LIST[i])) { if (bgc_fp64_vector3_is_unit(&_TEST_FP64_NONUNIT_VECTOR3_LIST[i])) {
print_testing_error("A non-unit vector was recognized as a unit vector"); print_testing_error("A non-unit vector was recognized as a unit vector");
return; return;
} }

View file

@ -7,35 +7,35 @@
static const int _TEST_FP32_ZERO_VECTOR3_AMOUNT = 7; static const int _TEST_FP32_ZERO_VECTOR3_AMOUNT = 7;
static const int _TEST_FP32_NONZERO_VECTOR3_AMOUNT = 9; static const int _TEST_FP32_NONZERO_VECTOR3_AMOUNT = 9;
static const BgcVector3FP32 _TEST_FP32_ZERO_VECTOR3_LIST[] = { static const BGC_FP32_Vector3 _TEST_FP32_ZERO_VECTOR3_LIST[] = {
{ 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f },
{ 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { -0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, -0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 0.75f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32 } { 0.0f, 0.0f, -0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcVector3FP32 _TEST_FP32_NONZERO_VECTOR3_LIST[] = { static const BGC_FP32_Vector3 _TEST_FP32_NONZERO_VECTOR3_LIST[] = {
{ 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f },
{ 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f }, { 0.0f, -1.25f * BGC_FP32_EPSYLON, 0.0f },
{ 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, 1.25f * BGC_FP32_EPSYLON },
{ 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32 }, { 0.0f, 0.0f, -1.25f * BGC_FP32_EPSYLON },
{ 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32, 0.0f }, { 1.25f * BGC_FP32_EPSYLON, 1.25f * BGC_FP32_EPSYLON, 0.0f },
{ -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32, 0.0f } { -1.25f * BGC_FP32_EPSYLON, -1.25f * BGC_FP32_EPSYLON, 0.0f }
}; };
void test_vector3_is_zero_fp32() void test_vector3_is_zero_fp32()
{ {
print_testing_name("bgc_vector3_is_zero_fp32"); print_testing_name("bgc_fp32_vector3_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_ZERO_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_ZERO_VECTOR3_AMOUNT; i++) {
if (!bgc_vector3_is_zero_fp32(&_TEST_FP32_ZERO_VECTOR3_LIST[i])) { if (!bgc_fp32_vector3_is_zero(&_TEST_FP32_ZERO_VECTOR3_LIST[i])) {
print_testing_error("A zero vector was not recongized"); print_testing_error("A zero vector was not recongized");
return; return;
} }
@ -43,7 +43,7 @@ void test_vector3_is_zero_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONZERO_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NONZERO_VECTOR3_AMOUNT; i++) {
if (bgc_vector3_is_zero_fp32(&_TEST_FP32_NONZERO_VECTOR3_LIST[i])) { if (bgc_fp32_vector3_is_zero(&_TEST_FP32_NONZERO_VECTOR3_LIST[i])) {
print_testing_error("A non-zero vector was recongized as a zero vector"); print_testing_error("A non-zero vector was recongized as a zero vector");
return; return;
} }
@ -57,35 +57,35 @@ void test_vector3_is_zero_fp32()
static const int _TEST_FP64_ZERO_VECTOR3_AMOUNT = 7; static const int _TEST_FP64_ZERO_VECTOR3_AMOUNT = 7;
static const int _TEST_FP64_NONZERO_VECTOR3_AMOUNT = 9; static const int _TEST_FP64_NONZERO_VECTOR3_AMOUNT = 9;
static const BgcVector3FP64 _TEST_FP64_ZERO_VECTOR3_LIST[] = { static const BGC_FP64_Vector3 _TEST_FP64_ZERO_VECTOR3_LIST[] = {
{ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 },
{ 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { -0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, -0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 0.75 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64 } { 0.0, 0.0, -0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcVector3FP64 _TEST_FP64_NONZERO_VECTOR3_LIST[] = { static const BGC_FP64_Vector3 _TEST_FP64_NONZERO_VECTOR3_LIST[] = {
{ 0.0, 1.0, 0.0 }, { 0.0, 1.0, 0.0 },
{ 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { -1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0 }, { 0.0, -1.25 * BGC_FP64_EPSYLON, 0.0 },
{ 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, 1.25 * BGC_FP64_EPSYLON },
{ 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64 }, { 0.0, 0.0, -1.25 * BGC_FP64_EPSYLON },
{ 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64, 0.0 }, { 1.25 * BGC_FP64_EPSYLON, 1.25 * BGC_FP64_EPSYLON, 0.0 },
{ -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64, 0.0 } { -BGC_FP64_EPSYLON, -BGC_FP64_EPSYLON, 0.0 }
}; };
void test_vector3_is_zero_fp64() void test_vector3_is_zero_fp64()
{ {
print_testing_name("bgc_vector3_is_zero_fp64"); print_testing_name("bgc_fp64_vector3_is_zero");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_ZERO_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_ZERO_VECTOR3_AMOUNT; i++) {
if (!bgc_vector3_is_zero_fp64(&_TEST_FP64_ZERO_VECTOR3_LIST[i])) { if (!bgc_fp64_vector3_is_zero(&_TEST_FP64_ZERO_VECTOR3_LIST[i])) {
print_testing_error("A zero vector was not recongized"); print_testing_error("A zero vector was not recongized");
return; return;
} }
@ -93,7 +93,7 @@ void test_vector3_is_zero_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONZERO_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NONZERO_VECTOR3_AMOUNT; i++) {
if (bgc_vector3_is_zero_fp64(&_TEST_FP64_NONZERO_VECTOR3_LIST[i])) { if (bgc_fp64_vector3_is_zero(&_TEST_FP64_NONZERO_VECTOR3_LIST[i])) {
print_testing_error("A non-zero vector was recongized as a zero vector"); print_testing_error("A non-zero vector was recongized as a zero vector");
return; return;
} }

View file

@ -6,7 +6,7 @@
static const int _TEST_FP32_VECTOR3_AMOUNT = 4; static const int _TEST_FP32_VECTOR3_AMOUNT = 4;
static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = { static const BGC_FP32_Vector3 _TEST_FP32_VECTOR3_LIST[] = {
{ 4.0f, 3.0f, 0.0f }, { 4.0f, 3.0f, 0.0f },
{ 0.0f, -3.0f, -4.0f }, { 0.0f, -3.0f, -4.0f },
{ 100.0f, -100.0f, 100.0f }, { 100.0f, -100.0f, 100.0f },
@ -29,10 +29,10 @@ static const float _TEST_FP32_MODULUS_LIST[] = {
void test_vector3_square_modulus_fp32() void test_vector3_square_modulus_fp32()
{ {
print_testing_name("bgc_vector3_get_square_modulus_fp32"); print_testing_name("bgc_fp32_vector3_get_square_modulus");
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_vector3_get_square_modulus_fp32(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) { if (!bgc_fp32_are_close(bgc_fp32_vector3_get_square_modulus(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_SQUARE_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -43,10 +43,10 @@ void test_vector3_square_modulus_fp32()
void test_vector3_modulus_fp32() void test_vector3_modulus_fp32()
{ {
print_testing_name("bgc_vector3_get_modulus_fp32"); print_testing_name("bgc_fp32_vector3_get_modulus");
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
if (!bgc_are_close_fp32(bgc_vector3_get_modulus_fp32(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) { if (!bgc_fp32_are_close(bgc_fp32_vector3_get_modulus(&_TEST_FP32_VECTOR3_LIST[i]), _TEST_FP32_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -59,7 +59,7 @@ void test_vector3_modulus_fp32()
static const int _TEST_FP64_VECTOR3_AMOUNT = 4; static const int _TEST_FP64_VECTOR3_AMOUNT = 4;
static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = { static const BGC_FP64_Vector3 _TEST_FP64_VECTOR3_LIST[] = {
{ 0.0, 4.0, 3.0 }, { 0.0, 4.0, 3.0 },
{ -3.0, 0.0, -4.0 }, { -3.0, 0.0, -4.0 },
{ 100.0, -100.0, 100.0 }, { 100.0, -100.0, 100.0 },
@ -82,10 +82,10 @@ static const double _TEST_FP64_MODULUS_LIST[] = {
void test_vector3_square_modulus_fp64() void test_vector3_square_modulus_fp64()
{ {
print_testing_name("bgc_vector3_get_square_modulus_fp64"); print_testing_name("bgc_fp64_vector3_get_square_modulus");
for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_vector3_get_square_modulus_fp64(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) { if (!bgc_fp64_are_close(bgc_fp64_vector3_get_square_modulus(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_SQUARE_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -96,10 +96,10 @@ void test_vector3_square_modulus_fp64()
void test_vector3_modulus_fp64() void test_vector3_modulus_fp64()
{ {
print_testing_name("bgc_vector3_get_modulus_fp64"); print_testing_name("bgc_fp64_vector3_get_modulus");
for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
if (!bgc_are_close_fp64(bgc_vector3_get_modulus_fp64(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) { if (!bgc_fp64_are_close(bgc_fp64_vector3_get_modulus(&_TEST_FP64_VECTOR3_LIST[i]), _TEST_FP64_MODULUS_LIST[i])) {
print_testing_failed(); print_testing_failed();
return; return;
} }

View file

@ -4,11 +4,11 @@
void test_vector3_reset_fp32() void test_vector3_reset_fp32()
{ {
BgcVector3FP32 vector; BGC_FP32_Vector3 vector;
print_testing_name("bgc_vector3_reset_fp32"); print_testing_name("bgc_fp32_vector3_reset");
bgc_vector3_reset_fp32(&vector); bgc_fp32_vector3_reset(&vector);
if (vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) { if (vector.x1 != 0.0f || vector.x2 != 0.0f || vector.x3 != 0.0f) {
print_testing_failed(); print_testing_failed();
@ -20,11 +20,11 @@ void test_vector3_reset_fp32()
void test_vector3_reset_fp64() void test_vector3_reset_fp64()
{ {
BgcVector3FP64 vector; BGC_FP64_Vector3 vector;
print_testing_name("bgc_vector3_reset_fp64"); print_testing_name("bgc_fp64_vector3_reset");
bgc_vector3_reset_fp64(&vector); bgc_fp64_vector3_reset(&vector);
if (vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) { if (vector.x1 != 0.0 || vector.x2 != 0.0 || vector.x3 != 0.0) {
print_testing_failed(); print_testing_failed();

View file

@ -8,25 +8,25 @@
void test_vector3_set_values_fp32() void test_vector3_set_values_fp32()
{ {
BgcVector3FP32 vector; BGC_FP32_Vector3 vector;
print_testing_name("bgc_vector3_set_values_fp32"); print_testing_name("bgc_fp32_vector3_make");
bgc_vector3_set_values_fp32(1.0f, 2.0f, 3.0f, &vector); bgc_fp32_vector3_make(1.0f, 2.0f, 3.0f, &vector);
if (vector.x1 != 1.0f || vector.x2 != 2.0f || vector.x3 != 3.0f) { if (vector.x1 != 1.0f || vector.x2 != 2.0f || vector.x3 != 3.0f) {
print_testing_error("First step failed"); print_testing_error("First step failed");
return; return;
} }
bgc_vector3_set_values_fp32(-3.0f, -5.0f, -7.0f, &vector); bgc_fp32_vector3_make(-3.0f, -5.0f, -7.0f, &vector);
if (vector.x1 != -3.0f || vector.x2 != -5.0f || vector.x3 != -7.0f) { if (vector.x1 != -3.0f || vector.x2 != -5.0f || vector.x3 != -7.0f) {
print_testing_error("Second step failed"); print_testing_error("Second step failed");
return; return;
} }
bgc_vector3_set_values_fp32(-2.0f, 2.0f, 4.0f, &vector); bgc_fp32_vector3_make(-2.0f, 2.0f, 4.0f, &vector);
if (vector.x1 != -2.0f || vector.x2 != 2.0f || vector.x3 != 4.0f) { if (vector.x1 != -2.0f || vector.x2 != 2.0f || vector.x3 != 4.0f) {
print_testing_error("Third step failed"); print_testing_error("Third step failed");
@ -40,26 +40,26 @@ void test_vector3_set_values_fp32()
void test_vector3_set_values_fp64() void test_vector3_set_values_fp64()
{ {
BgcVector3FP64 vector; BGC_FP64_Vector3 vector;
print_testing_name("bgc_vector3_set_values_fp64"); print_testing_name("bgc_fp64_vector3_make");
bgc_vector3_set_values_fp64(1.0, 2.0, 3.0, &vector); bgc_fp64_vector3_make(1.0, 2.0, 3.0, &vector);
if (vector.x1 != 1.0 || vector.x2 != 2.0 || vector.x3 != 3.0) { if (vector.x1 != 1.0 || vector.x2 != 2.0 || vector.x3 != 3.0) {
print_testing_error("First step failed"); print_testing_error("First step failed");
return; return;
} }
bgc_vector3_set_values_fp64(-3.0, -5.0, -7.0, &vector); bgc_fp64_vector3_make(-3.0, -5.0, -7.0, &vector);
if (vector.x1 != -3.0 || vector.x2 != -5.0 || vector.x3 != -7.0) { if (vector.x1 != -3.0 || vector.x2 != -5.0 || vector.x3 != -7.0) {
print_testing_error("Second step failed"); print_testing_error("Second step failed");
return; return;
} }
bgc_vector3_set_values_fp64(-2.0, 2.0, 4.0, &vector); bgc_fp64_vector3_make(-2.0, 2.0, 4.0, &vector);
if (vector.x1 != -2.0 || vector.x2 != 2.0 || vector.x3 != 4.0) { if (vector.x1 != -2.0 || vector.x2 != 2.0 || vector.x3 != 4.0) {
print_testing_error("Third step failed"); print_testing_error("Third step failed");

View file

@ -8,14 +8,14 @@
static const int _TEST_FP32_VECTOR3_AMOUNT = 4; static const int _TEST_FP32_VECTOR3_AMOUNT = 4;
static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST1[] = { static const BGC_FP32_Vector3 _TEST_FP32_VECTOR3_LIST1[] = {
{ 1.0f, 2.0f, 3.0f }, { 1.0f, 2.0f, 3.0f },
{ -3.0f, -2.0f, -1.0f }, { -3.0f, -2.0f, -1.0f },
{ 100.0f, -100.0f, 344.7f }, { 100.0f, -100.0f, 344.7f },
{ -100.1f, 100.2f, -271.3f } { -100.1f, 100.2f, -271.3f }
}; };
static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST2[] = { static const BGC_FP32_Vector3 _TEST_FP32_VECTOR3_LIST2[] = {
{ 3.6f, 5.3f, -0.123f }, { 3.6f, 5.3f, -0.123f },
{ 204.07f, -781.89f, 891.3f }, { 204.07f, -781.89f, 891.3f },
{ -20.02f, -1.0003f, 0.9275f }, { -20.02f, -1.0003f, 0.9275f },
@ -24,15 +24,15 @@ static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST2[] = {
void test_vector3_swap_fp32() void test_vector3_swap_fp32()
{ {
BgcVector3FP32 vector1, vector2; BGC_FP32_Vector3 vector1, vector2;
print_testing_name("bgc_vector3_swap_fp32"); print_testing_name("bgc_fp32_vector3_swap");
for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VECTOR3_AMOUNT; i++) {
bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST1[i], &vector1); bgc_fp32_vector3_copy(&_TEST_FP32_VECTOR3_LIST1[i], &vector1);
bgc_vector3_copy_fp32(&_TEST_FP32_VECTOR3_LIST2[i], &vector2); bgc_fp32_vector3_copy(&_TEST_FP32_VECTOR3_LIST2[i], &vector2);
bgc_vector3_swap_fp32(&vector1, &vector2); bgc_fp32_vector3_swap(&vector1, &vector2);
if (vector1.x1 != _TEST_FP32_VECTOR3_LIST2[i].x1 || if (vector1.x1 != _TEST_FP32_VECTOR3_LIST2[i].x1 ||
vector1.x2 != _TEST_FP32_VECTOR3_LIST2[i].x2 || vector1.x2 != _TEST_FP32_VECTOR3_LIST2[i].x2 ||
@ -52,14 +52,14 @@ void test_vector3_swap_fp32()
static const int _TEST_FP64_VECTOR3_AMOUNT = 4; static const int _TEST_FP64_VECTOR3_AMOUNT = 4;
static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST1[] = { static const BGC_FP64_Vector3 _TEST_FP64_VECTOR3_LIST1[] = {
{ 1.0, 2.0, 3.0 }, { 1.0, 2.0, 3.0 },
{ -3.0, -2.0, -1.0 }, { -3.0, -2.0, -1.0 },
{ 100.0, -100.0, 344.7 }, { 100.0, -100.0, 344.7 },
{ -100.1, 100.2, -271.3 } { -100.1, 100.2, -271.3 }
}; };
static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST2[] = { static const BGC_FP64_Vector3 _TEST_FP64_VECTOR3_LIST2[] = {
{ 3.6, 5.3, -0.123 }, { 3.6, 5.3, -0.123 },
{ 204.07, -781.89, 891.3 }, { 204.07, -781.89, 891.3 },
{ -20.02, -1.0003, 0.9275 }, { -20.02, -1.0003, 0.9275 },
@ -68,15 +68,15 @@ static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST2[] = {
void test_vector3_swap_fp64() void test_vector3_swap_fp64()
{ {
BgcVector3FP64 vector1, vector2; BGC_FP64_Vector3 vector1, vector2;
print_testing_name("bgc_vector3_swap_fp64"); print_testing_name("bgc_fp64_vector3_swap");
for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VECTOR3_AMOUNT; i++) {
bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST1[i], &vector1); bgc_fp64_vector3_copy(&_TEST_FP64_VECTOR3_LIST1[i], &vector1);
bgc_vector3_copy_fp64(&_TEST_FP64_VECTOR3_LIST2[i], &vector2); bgc_fp64_vector3_copy(&_TEST_FP64_VECTOR3_LIST2[i], &vector2);
bgc_vector3_swap_fp64(&vector1, &vector2); bgc_fp64_vector3_swap(&vector1, &vector2);
if (vector1.x1 != _TEST_FP64_VECTOR3_LIST2[i].x1 || if (vector1.x1 != _TEST_FP64_VECTOR3_LIST2[i].x1 ||
vector1.x2 != _TEST_FP64_VECTOR3_LIST2[i].x2 || vector1.x2 != _TEST_FP64_VECTOR3_LIST2[i].x2 ||

View file

@ -9,35 +9,35 @@ static const int _TEST_FP32_CLOSE_VERSOR_PAIR_AMOUNT = 10;
static const TestVersorPairFP32 _TEST_FP32_CLOSE_VERSOR_PAIR_LIST[] = { static const TestVersorPairFP32 _TEST_FP32_CLOSE_VERSOR_PAIR_LIST[] = {
{ {
{ 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f },
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f } { 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f }
}, },
{ {
{ 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f },
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f } { 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f }
}, },
{ {
{ 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f } { 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f }
}, },
{ {
{ 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f } { 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f }
}, },
{ {
{ 0.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f } { 0.0f, 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f }
}, },
{ {
{ 0.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f } { 0.0f, 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f }
}, },
{ {
{ 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 } { 0.0f, 0.0f, 0.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON }
}, },
{ {
{ 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 } { 0.0f, 0.0f, 0.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON }
}, },
{ {
{ 0.70710678f, 0.0f, 0.70710675f, 0.0f }, { 0.70710678f, 0.0f, 0.70710675f, 0.0f },
@ -54,35 +54,35 @@ static const int _TEST_FP32_DIFFERENT_VERSOR_PAIR_AMOUNT = 10;
static const TestVersorPairFP32 _TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[] = { static const TestVersorPairFP32 _TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[] = {
{ {
{ 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f },
{ 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f } { 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f }
}, },
{ {
{ 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f },
{ 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f } { 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f }
}, },
{ {
{ 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f } { 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f }
}, },
{ {
{ 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f } { 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f }
}, },
{ {
{ 0.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f } { 0.0f, 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON, 0.0f }
}, },
{ {
{ 0.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f } { 0.0f, 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON, 0.0f }
}, },
{ {
{ 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 } { 0.0f, 0.0f, 0.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON }
}, },
{ {
{ 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 } { 0.0f, 0.0f, 0.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON }
}, },
{ {
{ 0.707106f, 0.0f, 0.707107f, 0.0f }, { 0.707106f, 0.0f, 0.707107f, 0.0f },
@ -96,11 +96,11 @@ static const TestVersorPairFP32 _TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[] = {
void test_versor_are_close_fp32() void test_versor_are_close_fp32()
{ {
print_testing_name("bgc_versor_are_close_fp32"); print_testing_name("bgc_fp32_versor_are_close");
// Testing close pairs of versors: // Testing close pairs of versors:
for (int i = 0; i < _TEST_FP32_CLOSE_VERSOR_PAIR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_CLOSE_VERSOR_PAIR_AMOUNT; i++) {
if (!bgc_versor_are_close_fp32(&_TEST_FP32_CLOSE_VERSOR_PAIR_LIST[i].first, &_TEST_FP32_CLOSE_VERSOR_PAIR_LIST[i].second)) { if (!bgc_fp32_versor_are_close(&_TEST_FP32_CLOSE_VERSOR_PAIR_LIST[i].first, &_TEST_FP32_CLOSE_VERSOR_PAIR_LIST[i].second)) {
print_testing_error("A pair of close versors was not recognized"); print_testing_error("A pair of close versors was not recognized");
return; return;
} }
@ -108,7 +108,7 @@ void test_versor_are_close_fp32()
// Testing different pairs of versors: // Testing different pairs of versors:
for (int i = 0; i < _TEST_FP32_DIFFERENT_VERSOR_PAIR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_DIFFERENT_VERSOR_PAIR_AMOUNT; i++) {
if (bgc_versor_are_close_fp32(&_TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[i].first, &_TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[i].second)) { if (bgc_fp32_versor_are_close(&_TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[i].first, &_TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[i].second)) {
print_testing_error("A pair of different versors was recognized as close versors"); print_testing_error("A pair of different versors was recognized as close versors");
return; return;
} }
@ -125,35 +125,35 @@ static const int _TEST_FP64_CLOSE_VERSOR_PAIR_AMOUNT = 10;
static const TestVersorPairFP64 _TEST_FP64_CLOSE_VERSOR_PAIR_LIST[] = { static const TestVersorPairFP64 _TEST_FP64_CLOSE_VERSOR_PAIR_LIST[] = {
{ {
{ 1.0, 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0, 0.0 },
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 } { 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 }
}, },
{ {
{ 1.0, 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0, 0.0 },
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 } { 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 }
}, },
{ {
{ 0.0, 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 },
{ 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 } { 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 }
}, },
{ {
{ 0.0, 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 },
{ 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 } { 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 }
}, },
{ {
{ 0.0, 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0 },
{ 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 } { 0.0, 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0 }
}, },
{ {
{ 0.0, 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0 },
{ 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 } { 0.0, 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0 }
}, },
{ {
{ 0.0, 0.0, 0.0, 1.0 }, { 0.0, 0.0, 0.0, 1.0 },
{ 0.0, 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 } { 0.0, 0.0, 0.0, 1.0 + 0.75 * BGC_FP64_EPSYLON }
}, },
{ {
{ 0.0, 0.0, 0.0, 1.0 }, { 0.0, 0.0, 0.0, 1.0 },
{ 0.0, 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 } { 0.0, 0.0, 0.0, 1.0 - 0.75 * BGC_FP64_EPSYLON }
}, },
{ {
{ 0.7071067811865475244, 0.0, 0.7071067811865465244, 0.0 }, { 0.7071067811865475244, 0.0, 0.7071067811865465244, 0.0 },
@ -170,35 +170,35 @@ static const int _TEST_FP64_DIFFERENT_VERSOR_PAIR_AMOUNT = 10;
static const TestVersorPairFP64 _TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[] = { static const TestVersorPairFP64 _TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[] = {
{ {
{ 1.0, 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0, 0.0 },
{ 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 } { 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 }
}, },
{ {
{ 1.0, 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0, 0.0 },
{ 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 } { 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 }
}, },
{ {
{ 0.0, 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 },
{ 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 } { 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 }
}, },
{ {
{ 0.0, 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 },
{ 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 } { 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0, 0.0 }
}, },
{ {
{ 0.0, 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0 },
{ 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 } { 0.0, 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON, 0.0 }
}, },
{ {
{ 0.0, 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0 },
{ 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 } { 0.0, 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON, 0.0 }
}, },
{ {
{ 0.0, 0.0, 0.0, 1.0 }, { 0.0, 0.0, 0.0, 1.0 },
{ 0.0, 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 } { 0.0, 0.0, 0.0, 1.0 + 1.25 * BGC_FP64_EPSYLON }
}, },
{ {
{ 0.0, 0.0, 0.0, 1.0 }, { 0.0, 0.0, 0.0, 1.0 },
{ 0.0, 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 } { 0.0, 0.0, 0.0, 1.0 - 1.25 * BGC_FP64_EPSYLON }
}, },
{ {
{ 0.7071067811866, 0.0, 0.7071067811865, 0.0 }, { 0.7071067811866, 0.0, 0.7071067811865, 0.0 },
@ -212,11 +212,11 @@ static const TestVersorPairFP64 _TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[] = {
void test_versor_are_close_fp64() void test_versor_are_close_fp64()
{ {
print_testing_name("bgc_versor_are_close_fp64"); print_testing_name("bgc_fp64_versor_are_close");
// Testing close pairs of versors: // Testing close pairs of versors:
for (int i = 0; i < _TEST_FP64_CLOSE_VERSOR_PAIR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_CLOSE_VERSOR_PAIR_AMOUNT; i++) {
if (!bgc_versor_are_close_fp64(&_TEST_FP64_CLOSE_VERSOR_PAIR_LIST[i].first, &_TEST_FP64_CLOSE_VERSOR_PAIR_LIST[i].second)) { if (!bgc_fp64_versor_are_close(&_TEST_FP64_CLOSE_VERSOR_PAIR_LIST[i].first, &_TEST_FP64_CLOSE_VERSOR_PAIR_LIST[i].second)) {
print_testing_error("A pair of close versors was not recognized"); print_testing_error("A pair of close versors was not recognized");
return; return;
} }
@ -224,7 +224,7 @@ void test_versor_are_close_fp64()
// Testing different pairs of versors: // Testing different pairs of versors:
for (int i = 0; i < _TEST_FP64_DIFFERENT_VERSOR_PAIR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_DIFFERENT_VERSOR_PAIR_AMOUNT; i++) {
if (bgc_versor_are_close_fp64(&_TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[i].first, &_TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[i].second)) { if (bgc_fp64_versor_are_close(&_TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[i].first, &_TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[i].second)) {
print_testing_error("A pair of different versors was recognized as close versors"); print_testing_error("A pair of different versors was recognized as close versors");
return; return;
} }

View file

@ -38,14 +38,14 @@ static const TestVersorTripletFP32 _TEST_FP32_VERSOR_TRIPLET_LIST[] = {
void test_versor_combine_fp32() void test_versor_combine_fp32()
{ {
BgcVersorFP32 versor; BGC_FP32_Versor versor;
print_testing_name("bgc_versor_combine_fp32"); print_testing_name("bgc_fp32_versor_combine");
for (int i = 0; i < _TEST_FP32_VERSOR_TRIPLET_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VERSOR_TRIPLET_AMOUNT; i++) {
bgc_versor_combine_fp32(&_TEST_FP32_VERSOR_TRIPLET_LIST[i].first, &_TEST_FP32_VERSOR_TRIPLET_LIST[i].second, &versor); bgc_fp32_versor_combine(&_TEST_FP32_VERSOR_TRIPLET_LIST[i].first, &_TEST_FP32_VERSOR_TRIPLET_LIST[i].second, &versor);
if (!bgc_versor_are_close_fp32(&versor, &_TEST_FP32_VERSOR_TRIPLET_LIST[i].result)) { if (!bgc_fp32_versor_are_close(&versor, &_TEST_FP32_VERSOR_TRIPLET_LIST[i].result)) {
print_testing_failed(); print_testing_failed();
return; return;
} }
@ -88,14 +88,14 @@ static const TestVersorTripletFP64 _TEST_FP64_VERSOR_TRIPLET_LIST[] = {
void test_versor_combine_fp64() void test_versor_combine_fp64()
{ {
BgcVersorFP64 versor; BGC_FP64_Versor versor;
print_testing_name("bgc_versor_combine_fp64"); print_testing_name("bgc_fp64_versor_combine");
for (int i = 0; i < _TEST_FP64_VERSOR_TRIPLET_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VERSOR_TRIPLET_AMOUNT; i++) {
bgc_versor_combine_fp64(&_TEST_FP64_VERSOR_TRIPLET_LIST[i].first, &_TEST_FP64_VERSOR_TRIPLET_LIST[i].second, &versor); bgc_fp64_versor_combine(&_TEST_FP64_VERSOR_TRIPLET_LIST[i].first, &_TEST_FP64_VERSOR_TRIPLET_LIST[i].second, &versor);
if (!bgc_versor_are_close_fp64(&versor, &_TEST_FP64_VERSOR_TRIPLET_LIST[i].result)) { if (!bgc_fp64_versor_are_close(&versor, &_TEST_FP64_VERSOR_TRIPLET_LIST[i].result)) {
print_testing_failed(); print_testing_failed();
return; return;
} }

View file

@ -7,7 +7,7 @@
// ==================== FP32 ==================== // // ==================== FP32 ==================== //
static const int _TEST_FP32_VERSOR_AMOUNT = 8; static const int _TEST_FP32_VERSOR_AMOUNT = 8;
static const BgcVersorFP32 _TEST_FP32_VERSOR_LIST[] = { static const BGC_FP32_Versor _TEST_FP32_VERSOR_LIST[] = {
{ 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f },
{ -1.0f, 0.0f, 0.0f, 0.0f }, { -1.0f, 0.0f, 0.0f, 0.0f },
{ 0.182574185835f, 0.36514837167f, 0.54772255751f, 0.73029674334f }, { 0.182574185835f, 0.36514837167f, 0.54772255751f, 0.73029674334f },
@ -20,13 +20,13 @@ static const BgcVersorFP32 _TEST_FP32_VERSOR_LIST[] = {
void test_versor_copy_fp32() void test_versor_copy_fp32()
{ {
BgcVersorFP32 versor; BGC_FP32_Versor versor;
print_testing_name("bgc_versor_copy_fp32"); print_testing_name("bgc_fp32_versor_copy");
for (int i = 0; i < _TEST_FP32_VERSOR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VERSOR_AMOUNT; i++) {
bgc_versor_copy_fp32(&_TEST_FP32_VERSOR_LIST[i], &versor); bgc_fp32_versor_copy(&_TEST_FP32_VERSOR_LIST[i], &versor);
if (versor._s0 != _TEST_FP32_VERSOR_LIST[i]._s0 || if (versor._s0 != _TEST_FP32_VERSOR_LIST[i]._s0 ||
versor._x1 != _TEST_FP32_VERSOR_LIST[i]._x1 || versor._x1 != _TEST_FP32_VERSOR_LIST[i]._x1 ||
@ -43,7 +43,7 @@ void test_versor_copy_fp32()
// ==================== FP64 ==================== // // ==================== FP64 ==================== //
static const int _TEST_FP64_VERSOR_AMOUNT = 8; static const int _TEST_FP64_VERSOR_AMOUNT = 8;
static const BgcVersorFP64 _TEST_FP64_VERSOR_LIST[] = { static const BGC_FP64_Versor _TEST_FP64_VERSOR_LIST[] = {
{ 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f },
{ -1.0f, 0.0f, 0.0f, 0.0f }, { -1.0f, 0.0f, 0.0f, 0.0f },
{ 0.1825741858350553712, 0.3651483716701107423, 0.5477225575051661135, 0.7302967433402214846 }, { 0.1825741858350553712, 0.3651483716701107423, 0.5477225575051661135, 0.7302967433402214846 },
@ -56,13 +56,13 @@ static const BgcVersorFP64 _TEST_FP64_VERSOR_LIST[] = {
void test_versor_copy_fp64() void test_versor_copy_fp64()
{ {
BgcVersorFP64 versor; BGC_FP64_Versor versor;
print_testing_name("bgc_versor_copy_fp64"); print_testing_name("bgc_fp64_versor_copy");
for (int i = 0; i < _TEST_FP64_VERSOR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VERSOR_AMOUNT; i++) {
bgc_versor_copy_fp64(&_TEST_FP64_VERSOR_LIST[i], &versor); bgc_fp64_versor_copy(&_TEST_FP64_VERSOR_LIST[i], &versor);
if (versor._s0 != _TEST_FP64_VERSOR_LIST[i]._s0 || if (versor._s0 != _TEST_FP64_VERSOR_LIST[i]._s0 ||
versor._x1 != _TEST_FP64_VERSOR_LIST[i]._x1 || versor._x1 != _TEST_FP64_VERSOR_LIST[i]._x1 ||

View file

@ -7,33 +7,33 @@
static const int _TEST_FP32_IDENTIYTY_VERSOR_AMOUNT = 9; static const int _TEST_FP32_IDENTIYTY_VERSOR_AMOUNT = 9;
static const int _TEST_FP32_NON_IDENTIYTY_VERSOR_AMOUNT = 5; static const int _TEST_FP32_NON_IDENTIYTY_VERSOR_AMOUNT = 5;
static const BgcVersorFP32 _TEST_FP32_IDENTIYTY_VERSOR_LIST[] = { static const BGC_FP32_Versor _TEST_FP32_IDENTIYTY_VERSOR_LIST[] = {
{ 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f },
{ 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 1.0f + 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }, { 1.0f - 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f, 0.0f },
{ 1.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.0f, 0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 1.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }, { 1.0f, -0.75f * BGC_FP32_EPSYLON, 0.0f, 0.0f },
{ 1.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f, 0.0f, 0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 1.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f }, { 1.0f, 0.0f, -0.75f * BGC_FP32_EPSYLON, 0.0f },
{ 1.0f, 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32 }, { 1.0f, 0.0f, 0.0f, 0.75f * BGC_FP32_EPSYLON },
{ 1.0f, 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32 } { 1.0f, 0.0f, 0.0f, -0.75f * BGC_FP32_EPSYLON }
}; };
static const BgcVersorFP32 _TEST_FP32_NON_IDENTIYTY_VERSOR_LIST[] = { static const BGC_FP32_Versor _TEST_FP32_NON_IDENTIYTY_VERSOR_LIST[] = {
{ 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f },
{ 0.5f, 0.5f, 0.5f, 0.5f }, { 0.5f, 0.5f, 0.5f, 0.5f },
{ 1.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f } { 1.0f, -1.25f * BGC_FP32_EPSYLON, 0.0f, 0.0f }
}; };
void test_versor_is_identity_fp32() void test_versor_is_identity_fp32()
{ {
print_testing_name("bgc_versor_is_identity_fp32"); print_testing_name("bgc_fp32_versor_is_idle");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP32_IDENTIYTY_VERSOR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_IDENTIYTY_VERSOR_AMOUNT; i++) {
if (!bgc_versor_is_identity_fp32(&_TEST_FP32_IDENTIYTY_VERSOR_LIST[i])) { if (!bgc_fp32_versor_is_idle(&_TEST_FP32_IDENTIYTY_VERSOR_LIST[i])) {
print_testing_error("An identity versor was not recognized"); print_testing_error("An identity versor was not recognized");
return; return;
} }
@ -41,7 +41,7 @@ void test_versor_is_identity_fp32()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NON_IDENTIYTY_VERSOR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_NON_IDENTIYTY_VERSOR_AMOUNT; i++) {
if (bgc_versor_is_identity_fp32(&_TEST_FP32_NON_IDENTIYTY_VERSOR_LIST[i])) { if (bgc_fp32_versor_is_idle(&_TEST_FP32_NON_IDENTIYTY_VERSOR_LIST[i])) {
print_testing_error("A non-identity versor was recognized as an identity versor"); print_testing_error("A non-identity versor was recognized as an identity versor");
return; return;
} }
@ -55,33 +55,33 @@ void test_versor_is_identity_fp32()
static const int _TEST_FP64_IDENTIYTY_VERSOR_AMOUNT = 9; static const int _TEST_FP64_IDENTIYTY_VERSOR_AMOUNT = 9;
static const int _TEST_FP64_NON_IDENTIYTY_VERSOR_AMOUNT = 5; static const int _TEST_FP64_NON_IDENTIYTY_VERSOR_AMOUNT = 5;
static const BgcVersorFP64 _TEST_FP64_IDENTIYTY_VERSOR_LIST[] = { static const BGC_FP64_Versor _TEST_FP64_IDENTIYTY_VERSOR_LIST[] = {
{ 1.0, 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0, 0.0 },
{ 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 1.0 + 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }, { 1.0 - 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0, 0.0 },
{ 1.0, -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.0, -0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 1.0, 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }, { 1.0, 0.75 * BGC_FP64_EPSYLON, 0.0, 0.0 },
{ 1.0, 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0 }, { 1.0, 0.0, 0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 1.0, 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0 }, { 1.0, 0.0, -0.75 * BGC_FP64_EPSYLON, 0.0 },
{ 1.0, 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64 }, { 1.0, 0.0, 0.0, 0.75 * BGC_FP64_EPSYLON },
{ 1.0, 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64 } { 1.0, 0.0, 0.0, -0.75 * BGC_FP64_EPSYLON }
}; };
static const BgcVersorFP64 _TEST_FP64_NON_IDENTIYTY_VERSOR_LIST[] = { static const BGC_FP64_Versor _TEST_FP64_NON_IDENTIYTY_VERSOR_LIST[] = {
{ 0.0, 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 },
{ 0.0, 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0 },
{ 0.0, 0.0, 0.0, 1.0 }, { 0.0, 0.0, 0.0, 1.0 },
{ 0.5, 0.5, 0.5, 0.5 }, { 0.5, 0.5, 0.5, 0.5 },
{ 1.0, 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0 } { 1.0, 0.0, 1.25 * BGC_FP64_EPSYLON, 0.0 }
}; };
void test_versor_is_identity_fp64() void test_versor_is_identity_fp64()
{ {
print_testing_name("bgc_versor_is_identity_fp64"); print_testing_name("bgc_fp64_versor_is_idle");
// Testing zero values: // Testing zero values:
for (int i = 0; i < _TEST_FP64_IDENTIYTY_VERSOR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_IDENTIYTY_VERSOR_AMOUNT; i++) {
if (!bgc_versor_is_identity_fp64(&_TEST_FP64_IDENTIYTY_VERSOR_LIST[i])) { if (!bgc_fp64_versor_is_idle(&_TEST_FP64_IDENTIYTY_VERSOR_LIST[i])) {
print_testing_error("An identity versor was not recognized"); print_testing_error("An identity versor was not recognized");
return; return;
} }
@ -89,7 +89,7 @@ void test_versor_is_identity_fp64()
// Testing non-zero values: // Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NON_IDENTIYTY_VERSOR_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_NON_IDENTIYTY_VERSOR_AMOUNT; i++) {
if (bgc_versor_is_identity_fp64(&_TEST_FP64_NON_IDENTIYTY_VERSOR_LIST[i])) { if (bgc_fp64_versor_is_idle(&_TEST_FP64_NON_IDENTIYTY_VERSOR_LIST[i])) {
print_testing_error("A non-identity versor was recognized as an identity versor"); print_testing_error("A non-identity versor was recognized as an identity versor");
return; return;
} }

View file

@ -4,11 +4,11 @@
void test_versor_reset_fp32() void test_versor_reset_fp32()
{ {
BgcVersorFP32 versor; BGC_FP32_Versor versor;
print_testing_name("bgc_versor_reset_fp32"); print_testing_name("bgc_fp32_versor_reset");
bgc_versor_reset_fp32(&versor); bgc_fp32_versor_reset(&versor);
if (versor._s0 != 1.0f || versor._x1 != 0.0f || versor._x2 != 0.0f || versor._x3 != 0.0f) { if (versor._s0 != 1.0f || versor._x1 != 0.0f || versor._x2 != 0.0f || versor._x3 != 0.0f) {
print_testing_failed(); print_testing_failed();
@ -20,11 +20,11 @@ void test_versor_reset_fp32()
void test_versor_reset_fp64() void test_versor_reset_fp64()
{ {
BgcVersorFP64 versor; BGC_FP64_Versor versor;
print_testing_name("bgc_versor_reset_fp64"); print_testing_name("bgc_fp64_versor_reset");
bgc_versor_reset_fp64(&versor); bgc_fp64_versor_reset(&versor);
if (versor._s0 != 1.0 || versor._x1 != 0.0 || versor._x2 != 0.0 || versor._x3 != 0.0) { if (versor._s0 != 1.0 || versor._x1 != 0.0 || versor._x2 != 0.0 || versor._x3 != 0.0) {
print_testing_failed(); print_testing_failed();

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

@ -7,7 +7,7 @@
// ==================== FP32 ==================== // // ==================== FP32 ==================== //
static const int _TEST_FP32_VERSOR_DATA_AMOUNT = 4; static const int _TEST_FP32_VERSOR_DATA_AMOUNT = 4;
static const BgcQuaternionFP32 _TEST_FP32_VERSOR_DATA_LIST[] = { static const BGC_FP32_Quaternion _TEST_FP32_VERSOR_DATA_LIST[] = {
{ 1.0f, 2.0f, 3.0f, 4.0f }, { 1.0f, 2.0f, 3.0f, 4.0f },
{ 4.0f, 3.0f, 2.0f, 1.0f }, { 4.0f, 3.0f, 2.0f, 1.0f },
{ -1.0f, 0.0f, 0.0f, 0.0f }, { -1.0f, 0.0f, 0.0f, 0.0f },
@ -17,12 +17,12 @@ static const BgcQuaternionFP32 _TEST_FP32_VERSOR_DATA_LIST[] = {
void test_versor_set_values_fp32() void test_versor_set_values_fp32()
{ {
float versor_module, ratio; float versor_module, ratio;
BgcVersorFP32 versor; BGC_FP32_Versor versor;
print_testing_name("bgc_versor_set_values_fp32"); print_testing_name("bgc_fp32_versor_make");
for (int i = 0; i < _TEST_FP32_VERSOR_DATA_AMOUNT; i++) { for (int i = 0; i < _TEST_FP32_VERSOR_DATA_AMOUNT; i++) {
bgc_versor_set_values_fp32( bgc_fp32_versor_make(
_TEST_FP32_VERSOR_DATA_LIST[i].s0, _TEST_FP32_VERSOR_DATA_LIST[i].s0,
_TEST_FP32_VERSOR_DATA_LIST[i].x1, _TEST_FP32_VERSOR_DATA_LIST[i].x1,
_TEST_FP32_VERSOR_DATA_LIST[i].x2, _TEST_FP32_VERSOR_DATA_LIST[i].x2,
@ -32,28 +32,28 @@ void test_versor_set_values_fp32()
versor_module = sqrtf(versor._s0 * versor._s0 + versor._x1 * versor._x1 + versor._x2 * versor._x2 + versor._x3 * versor._x3); versor_module = sqrtf(versor._s0 * versor._s0 + versor._x1 * versor._x1 + versor._x2 * versor._x2 + versor._x3 * versor._x3);
if (!bgc_is_unit_fp32(versor_module)) { if (!bgc_fp32_is_unit(versor_module)) {
print_testing_error("Versor module is not equal to one."); print_testing_error("Versor module is not equal to one.");
return; return;
} }
if (bgc_is_zero_fp32(_TEST_FP32_VERSOR_DATA_LIST[i].s0)) { if (bgc_fp32_is_zero(_TEST_FP32_VERSOR_DATA_LIST[i].s0)) {
continue; continue;
} }
ratio = _TEST_FP32_VERSOR_DATA_LIST[i].s0 / versor._s0; ratio = _TEST_FP32_VERSOR_DATA_LIST[i].s0 / versor._s0;
if (!bgc_is_zero_fp32(_TEST_FP32_VERSOR_DATA_LIST[i].x1) && !bgc_are_close_fp32(ratio, _TEST_FP32_VERSOR_DATA_LIST[i].x1 / versor._x1)) { if (!bgc_fp32_is_zero(_TEST_FP32_VERSOR_DATA_LIST[i].x1) && !bgc_fp32_are_close(ratio, _TEST_FP32_VERSOR_DATA_LIST[i].x1 / versor._x1)) {
print_testing_error("Versor was not normalized proportionally (x1)."); print_testing_error("Versor was not normalized proportionally (x1).");
return; return;
} }
if (!bgc_is_zero_fp32(_TEST_FP32_VERSOR_DATA_LIST[i].x2) && !bgc_are_close_fp32(ratio, _TEST_FP32_VERSOR_DATA_LIST[i].x2 / versor._x2)) { if (!bgc_fp32_is_zero(_TEST_FP32_VERSOR_DATA_LIST[i].x2) && !bgc_fp32_are_close(ratio, _TEST_FP32_VERSOR_DATA_LIST[i].x2 / versor._x2)) {
print_testing_error("Versor was not normalized proportionally (x2)."); print_testing_error("Versor was not normalized proportionally (x2).");
return; return;
} }
if (!bgc_is_zero_fp32(_TEST_FP32_VERSOR_DATA_LIST[i].x3) && !bgc_are_close_fp32(ratio, _TEST_FP32_VERSOR_DATA_LIST[i].x3 / versor._x3)) { if (!bgc_fp32_is_zero(_TEST_FP32_VERSOR_DATA_LIST[i].x3) && !bgc_fp32_are_close(ratio, _TEST_FP32_VERSOR_DATA_LIST[i].x3 / versor._x3)) {
print_testing_error("Versor was not normalized proportionally (x3)."); print_testing_error("Versor was not normalized proportionally (x3).");
return; return;
} }
@ -65,7 +65,7 @@ void test_versor_set_values_fp32()
// ==================== FP64 ==================== // // ==================== FP64 ==================== //
static const int _TEST_FP64_VERSOR_DATA_AMOUNT = 4; static const int _TEST_FP64_VERSOR_DATA_AMOUNT = 4;
static const BgcQuaternionFP64 _TEST_FP64_VERSOR_DATA_LIST[] = { static const BGC_FP64_Quaternion _TEST_FP64_VERSOR_DATA_LIST[] = {
{ 1.0, 2.0, 3.0, 4.0 }, { 1.0, 2.0, 3.0, 4.0 },
{ 4.0, 3.0, 2.0, 1.0 }, { 4.0, 3.0, 2.0, 1.0 },
{ -1.0, 0.0, 0.0, 0.0 }, { -1.0, 0.0, 0.0, 0.0 },
@ -75,12 +75,12 @@ static const BgcQuaternionFP64 _TEST_FP64_VERSOR_DATA_LIST[] = {
void test_versor_set_values_fp64() void test_versor_set_values_fp64()
{ {
double versor_module, ratio; double versor_module, ratio;
BgcVersorFP64 versor; BGC_FP64_Versor versor;
print_testing_name("bgc_versor_set_values_fp64"); print_testing_name("bgc_fp64_versor_make");
for (int i = 0; i < _TEST_FP64_VERSOR_DATA_AMOUNT; i++) { for (int i = 0; i < _TEST_FP64_VERSOR_DATA_AMOUNT; i++) {
bgc_versor_set_values_fp64( bgc_fp64_versor_make(
_TEST_FP64_VERSOR_DATA_LIST[i].s0, _TEST_FP64_VERSOR_DATA_LIST[i].s0,
_TEST_FP64_VERSOR_DATA_LIST[i].x1, _TEST_FP64_VERSOR_DATA_LIST[i].x1,
_TEST_FP64_VERSOR_DATA_LIST[i].x2, _TEST_FP64_VERSOR_DATA_LIST[i].x2,
@ -90,28 +90,28 @@ void test_versor_set_values_fp64()
versor_module = sqrt(versor._s0 * versor._s0 + versor._x1 * versor._x1 + versor._x2 * versor._x2 + versor._x3 * versor._x3); versor_module = sqrt(versor._s0 * versor._s0 + versor._x1 * versor._x1 + versor._x2 * versor._x2 + versor._x3 * versor._x3);
if (!bgc_is_unit_fp64(versor_module)) { if (!bgc_fp64_is_unit(versor_module)) {
print_testing_error("Versor module is not equal to one."); print_testing_error("Versor module is not equal to one.");
return; return;
} }
if (bgc_is_zero_fp64(_TEST_FP64_VERSOR_DATA_LIST[i].s0)) { if (bgc_fp64_is_zero(_TEST_FP64_VERSOR_DATA_LIST[i].s0)) {
continue; continue;
} }
ratio = _TEST_FP64_VERSOR_DATA_LIST[i].s0 / versor._s0; ratio = _TEST_FP64_VERSOR_DATA_LIST[i].s0 / versor._s0;
if (!bgc_is_zero_fp64(_TEST_FP64_VERSOR_DATA_LIST[i].x1) && !bgc_are_close_fp64(ratio, _TEST_FP64_VERSOR_DATA_LIST[i].x1 / versor._x1)) { if (!bgc_fp64_is_zero(_TEST_FP64_VERSOR_DATA_LIST[i].x1) && !bgc_fp64_are_close(ratio, _TEST_FP64_VERSOR_DATA_LIST[i].x1 / versor._x1)) {
print_testing_error("Versor was not normalized proportionally (x1)."); print_testing_error("Versor was not normalized proportionally (x1).");
return; return;
} }