diff --git a/basic-geometry-test/basic-geometry-test.cbp b/basic-geometry-test/basic-geometry-test.cbp
index 332417f..40b18fd 100644
--- a/basic-geometry-test/basic-geometry-test.cbp
+++ b/basic-geometry-test/basic-geometry-test.cbp
@@ -57,6 +57,14 @@
+
+
+
+
+
+
+
+
@@ -97,6 +105,10 @@
+
+
+
+
@@ -121,6 +133,10 @@
+
+
+
+
@@ -153,6 +169,10 @@
+
+
+
+
diff --git a/basic-geometry-test/basic-geometry-test.vcxproj b/basic-geometry-test/basic-geometry-test.vcxproj
index 5cf7146..82b567a 100644
--- a/basic-geometry-test/basic-geometry-test.vcxproj
+++ b/basic-geometry-test/basic-geometry-test.vcxproj
@@ -152,6 +152,8 @@
+
+
@@ -161,12 +163,14 @@
+
+
@@ -174,6 +178,7 @@
+
@@ -184,6 +189,8 @@
+
+
@@ -193,12 +200,14 @@
+
+
@@ -206,6 +215,7 @@
+
diff --git a/basic-geometry-test/basic-geometry-test.vcxproj.filters b/basic-geometry-test/basic-geometry-test.vcxproj.filters
index bc52e7a..e18957e 100644
--- a/basic-geometry-test/basic-geometry-test.vcxproj.filters
+++ b/basic-geometry-test/basic-geometry-test.vcxproj.filters
@@ -90,6 +90,21 @@
tests\vector2
+
+ tests\quaternion
+
+
+ tests\quaternion
+
+
+ tests\vector3
+
+
+ tests\vector2
+
+
+ tests\versor
+
@@ -180,6 +195,21 @@
tests\vector2
+
+ tests\quaternion
+
+
+ tests\quaternion
+
+
+ tests\vector3
+
+
+ tests\vector2
+
+
+ tests\versor
+
diff --git a/basic-geometry-test/tests/quaternion.c b/basic-geometry-test/tests/quaternion.c
index 03a6357..b3339f4 100644
--- a/basic-geometry-test/tests/quaternion.c
+++ b/basic-geometry-test/tests/quaternion.c
@@ -4,23 +4,31 @@ int test_quaternion()
{
print_testing_section("BGC Quaternion");
- if (test_bgc_quaternion_reset() != TEST_SUCCES) {
+ if (test_quaternion_reset() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_set_to_identity() != TEST_SUCCES) {
+ if (test_quaternion_set_to_identity() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_set_values() != TEST_SUCCES) {
+ if (test_quaternion_set_values() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_copy() != TEST_SUCCES) {
+ if (test_quaternion_copy() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_swap() != TEST_SUCCES) {
+ if (test_quaternion_swap() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_quaternion_is_zero() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_quaternion_is_unit() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/quaternion.h b/basic-geometry-test/tests/quaternion.h
index 18ab9d2..47471b9 100644
--- a/basic-geometry-test/tests/quaternion.h
+++ b/basic-geometry-test/tests/quaternion.h
@@ -7,6 +7,8 @@
#include "./quaternion/quaternion_set_values.h"
#include "./quaternion/quaternion_copy.h"
#include "./quaternion/quaternion_swap.h"
+#include "./quaternion/quaternion_is_zero.h"
+#include "./quaternion/quaternion_is_unit.h"
int test_quaternion();
diff --git a/basic-geometry-test/tests/quaternion/quaternion_copy.c b/basic-geometry-test/tests/quaternion/quaternion_copy.c
index 189a6b7..d598ea0 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_copy.c
+++ b/basic-geometry-test/tests/quaternion/quaternion_copy.c
@@ -14,7 +14,7 @@ static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST[] = {
{ 0.001f, -100.0f, 100.0f, -0.001f }
};
-int test_bgc_quaternion_copy_fp32()
+int test_quaternion_copy_fp32()
{
BgcQuaternionFP32 vector;
@@ -48,7 +48,7 @@ static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST[] = {
{ 0.001, -100.0, 100.0, -0.001 }
};
-int test_bgc_quaternion_copy_fp64()
+int test_quaternion_copy_fp64()
{
BgcQuaternionFP64 vector;
@@ -72,13 +72,13 @@ int test_bgc_quaternion_copy_fp64()
return TEST_SUCCES;
}
-int test_bgc_quaternion_copy()
+int test_quaternion_copy()
{
- if (test_bgc_quaternion_copy_fp32() != TEST_SUCCES) {
+ if (test_quaternion_copy_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_copy_fp64() != TEST_SUCCES) {
+ if (test_quaternion_copy_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_copy.h b/basic-geometry-test/tests/quaternion/quaternion_copy.h
index 85a6a85..d271300 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_copy.h
+++ b/basic-geometry-test/tests/quaternion/quaternion_copy.h
@@ -1,10 +1,10 @@
#ifndef _TEST_QUATERNION_COPY_H_
#define _TEST_QUATERNION_COPY_H_
-int test_bgc_quaternion_copy_fp32();
+int test_quaternion_copy_fp32();
-int test_bgc_quaternion_copy_fp64();
+int test_quaternion_copy_fp64();
-int test_bgc_quaternion_copy();
+int test_quaternion_copy();
#endif
diff --git a/basic-geometry-test/tests/quaternion/quaternion_is_unit.c b/basic-geometry-test/tests/quaternion/quaternion_is_unit.c
new file mode 100644
index 0000000..c892488
--- /dev/null
+++ b/basic-geometry-test/tests/quaternion/quaternion_is_unit.c
@@ -0,0 +1,140 @@
+#include "./quaternion_is_unit.h"
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_UNIT_QUATERNION_AMOUNT = 16;
+static const int _TEST_FP32_NONUNIT_QUATERNION_AMOUNT = 10;
+
+static const BgcQuaternionFP32 _TEST_FP32_UNIT_QUATERNION_LIST[] = {
+ { 1.0f, 0.0f, 0.0f, 0.0f },
+ { -1.0f, 0.0f, 0.0f, 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_EPSYLON_FP32, 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_EPSYLON_FP32, 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_EPSYLON_FP32, 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_EPSYLON_FP32 },
+ { 0.5f, 0.5f, 0.5f, 0.5f },
+ { 0.5f + 0.75f * BGC_EPSYLON_FP32, 0.5f, 0.5f, 0.5f },
+ { 0.5f, 0.5f - 0.75f * BGC_EPSYLON_FP32, 0.5f, 0.5f },
+ { 0.5f, 0.5f, 0.5f + 0.75f * BGC_EPSYLON_FP32, 0.5f },
+ { 0.5f, 0.5f, 0.5f, 0.5f - 0.75f * BGC_EPSYLON_FP32 }
+};
+
+static const BgcQuaternionFP32 _TEST_FP32_NONUNIT_QUATERION_LIST[] = {
+ { 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
+ { 1.0f - 1.25f * BGC_EPSYLON_FP32, 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_EPSYLON_FP32, 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_EPSYLON_FP32, 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_EPSYLON_FP32 },
+ { 0.5f + 1.25f * BGC_EPSYLON_FP32, 0.5f + 1.25f * BGC_EPSYLON_FP32, 0.5f, 0.5f },
+ { 0.5f - 1.25f * BGC_EPSYLON_FP32, 0.5f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.5f }
+};
+
+int test_quaternion_is_unit_fp32()
+{
+ print_testing_name("bgc_quaternion_is_unit_fp32");
+
+ // Testing zero values:
+ for (int i = 0; i < _TEST_FP32_UNIT_QUATERNION_AMOUNT; i++) {
+ if (!bgc_quaternion_is_unit_fp32(&_TEST_FP32_UNIT_QUATERNION_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ // Testing non-zero values:
+ for (int i = 0; i < _TEST_FP32_NONUNIT_QUATERNION_AMOUNT; i++) {
+ if (bgc_quaternion_is_unit_fp32(&_TEST_FP32_NONUNIT_QUATERION_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_UNIT_QUATERNION_AMOUNT = 16;
+static const int _TEST_FP64_NONUNIT_QUATERNION_AMOUNT = 10;
+
+static const BgcQuaternionFP64 _TEST_FP64_UNIT_QUATERNION_LIST[] = {
+ { 1.0, 0.0, 0.0, 0.0 },
+ { -1.0, 0.0, 0.0, 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_EPSYLON_FP64, 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_EPSYLON_FP64, 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_EPSYLON_FP64, 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_EPSYLON_FP64 },
+ { 0.5, 0.5, 0.5, 0.5 },
+ { 0.5 + 0.75 * BGC_EPSYLON_FP64, 0.5, 0.5, 0.5 },
+ { 0.5, 0.5 - 0.75 * BGC_EPSYLON_FP64, 0.5, 0.5 },
+ { 0.5, 0.5, 0.5 + 0.75 * BGC_EPSYLON_FP64, 0.5 },
+ { 0.5, 0.5, 0.5, 0.5 - 0.75 * BGC_EPSYLON_FP64 }
+};
+
+static const BgcQuaternionFP64 _TEST_FP64_NONUNIT_QUATERION_LIST[] = {
+ { 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
+ { 1.0 - 1.25 * BGC_EPSYLON_FP64, 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_EPSYLON_FP64, 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_EPSYLON_FP64, 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_EPSYLON_FP64 },
+ { 0.5 + 1.25 * BGC_EPSYLON_FP64, 0.5 + 1.25 * BGC_EPSYLON_FP64, 0.5, 0.5 },
+ { 0.5 - 1.25 * BGC_EPSYLON_FP64, 0.5 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.5 }
+};
+
+int test_quaternion_is_unit_fp64()
+{
+ print_testing_name("bgc_quaternion_is_unit_fp64");
+
+ // Testing zero values:
+ for (int i = 0; i < _TEST_FP64_UNIT_QUATERNION_AMOUNT; i++) {
+ if (!bgc_quaternion_is_unit_fp64(&_TEST_FP64_UNIT_QUATERNION_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ // Testing non-zero values:
+ for (int i = 0; i < _TEST_FP64_NONUNIT_QUATERNION_AMOUNT; i++) {
+ if (bgc_quaternion_is_unit_fp64(&_TEST_FP64_NONUNIT_QUATERION_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+int test_quaternion_is_unit()
+{
+ if (test_quaternion_is_unit_fp32() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_quaternion_is_unit_fp64() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_is_unit.h b/basic-geometry-test/tests/quaternion/quaternion_is_unit.h
new file mode 100644
index 0000000..3b80213
--- /dev/null
+++ b/basic-geometry-test/tests/quaternion/quaternion_is_unit.h
@@ -0,0 +1,10 @@
+#ifndef _TEST_QUATERNION_IS_UNIT_H_
+#define _TEST_QUATERNION_IS_UNIT_H_
+
+int test_quaternion_is_unit_fp32();
+
+int test_quaternion_is_unit_fp64();
+
+int test_quaternion_is_unit();
+
+#endif
diff --git a/basic-geometry-test/tests/quaternion/quaternion_is_zero.c b/basic-geometry-test/tests/quaternion/quaternion_is_zero.c
index cc6b52b..06375a6 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_is_zero.c
+++ b/basic-geometry-test/tests/quaternion/quaternion_is_zero.c
@@ -19,7 +19,7 @@ static const BgcQuaternionFP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = {
{ 0.0f, 0.0f, 0.0f, -BGC_EPSYLON_FP32 }
};
-static const BgcQuaternionFP32 _TEST_FP32_NONZERO_NUMBERS[] = {
+static const BgcQuaternionFP32 _TEST_FP32_NONZERO_QUATERION_LIST[] = {
{ 0.0f, 1.0f, 0.0f, 0.0f },
{ 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
{ -1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
@@ -33,7 +33,7 @@ static const BgcQuaternionFP32 _TEST_FP32_NONZERO_NUMBERS[] = {
{ -BGC_EPSYLON_FP32, -BGC_EPSYLON_FP32, 0.0f, 0.0f }
};
-int test_bgc_quaternion_is_zero_fp32()
+int test_quaternion_is_zero_fp32()
{
print_testing_name("bgc_quaternion_is_zero_fp32");
@@ -47,7 +47,7 @@ int test_bgc_quaternion_is_zero_fp32()
// Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONZERO_QUATERNION_AMOUNT; i++) {
- if (bgc_quaternion_is_zero_fp32(&_TEST_FP32_NONZERO_NUMBERS[i])) {
+ if (bgc_quaternion_is_zero_fp32(&_TEST_FP32_NONZERO_QUATERION_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
@@ -75,7 +75,7 @@ static const BgcQuaternionFP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = {
{ 0.0, 0.0, 0.0, -BGC_EPSYLON_FP64 }
};
-static const BgcQuaternionFP64 _TEST_FP64_NONZERO_NUMBERS[] = {
+static const BgcQuaternionFP64 _TEST_FP64_NONZERO_QUATERION_LIST[] = {
{ 0.0, 1.0, 0.0, 0.0 },
{ 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
{ -1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
@@ -89,13 +89,13 @@ static const BgcQuaternionFP64 _TEST_FP64_NONZERO_NUMBERS[] = {
{ -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64, 0.0, 0.0 }
};
-int test_bgc_quaternion_is_zero_fp64()
+int test_quaternion_is_zero_fp64()
{
print_testing_name("bgc_quaternion_is_zero_fp64");
// Testing zero values:
for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) {
- if (!test_bgc_quaternion_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) {
+ if (!bgc_quaternion_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
@@ -103,7 +103,7 @@ int test_bgc_quaternion_is_zero_fp64()
// Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONZERO_QUATERNION_AMOUNT; i++) {
- if (test_bgc_quaternion_is_zero_fp64(&_TEST_FP64_NONZERO_NUMBERS[i])) {
+ if (bgc_quaternion_is_zero_fp64(&_TEST_FP64_NONZERO_QUATERION_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
@@ -114,13 +114,13 @@ int test_bgc_quaternion_is_zero_fp64()
return TEST_SUCCES;
}
-int test_bgc_quaternion_is_zero()
+int test_quaternion_is_zero()
{
- if (test_bgc_quaternion_is_zero_fp32() != TEST_SUCCES) {
+ if (test_quaternion_is_zero_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_is_zero_fp64() != TEST_SUCCES) {
+ if (test_quaternion_is_zero_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_is_zero.h b/basic-geometry-test/tests/quaternion/quaternion_is_zero.h
index 2f98145..f38d04d 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_is_zero.h
+++ b/basic-geometry-test/tests/quaternion/quaternion_is_zero.h
@@ -1,10 +1,10 @@
#ifndef _TEST_QUATERNION_IS_ZERO_H_
#define _TEST_QUATERNION_IS_ZERO_H_
-int test_bgc_quaternion_is_zero_fp32();
+int test_quaternion_is_zero_fp32();
-int test_bgc_quaternion_is_zero_fp64();
+int test_quaternion_is_zero_fp64();
-int test_bgc_quaternion_is_zero();
+int test_quaternion_is_zero();
#endif
diff --git a/basic-geometry-test/tests/quaternion/quaternion_reset.c b/basic-geometry-test/tests/quaternion/quaternion_reset.c
index d497957..ba46bdb 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_reset.c
+++ b/basic-geometry-test/tests/quaternion/quaternion_reset.c
@@ -2,7 +2,7 @@
#include "./../../helpers.h"
-int test_bgc_quaternion_reset_fp32()
+int test_quaternion_reset_fp32()
{
BgcQuaternionFP32 vector;
@@ -20,7 +20,7 @@ int test_bgc_quaternion_reset_fp32()
return TEST_SUCCES;
}
-int test_bgc_quaternion_reset_fp64()
+int test_quaternion_reset_fp64()
{
BgcQuaternionFP64 vector;
@@ -38,13 +38,13 @@ int test_bgc_quaternion_reset_fp64()
return TEST_SUCCES;
}
-int test_bgc_quaternion_reset()
+int test_quaternion_reset()
{
- if (test_bgc_quaternion_reset_fp32() != TEST_SUCCES) {
+ if (test_quaternion_reset_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_reset_fp64() != TEST_SUCCES) {
+ if (test_quaternion_reset_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_reset.h b/basic-geometry-test/tests/quaternion/quaternion_reset.h
index 55fc3a1..d9cfc5d 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_reset.h
+++ b/basic-geometry-test/tests/quaternion/quaternion_reset.h
@@ -1,10 +1,10 @@
#ifndef _TEST_QUATERNION_RESET_H_
#define _TEST_QUATERNION_RESET_H_
-int test_bgc_quaternion_reset_fp32();
+int test_quaternion_reset_fp32();
-int test_bgc_quaternion_reset_fp64();
+int test_quaternion_reset_fp64();
-int test_bgc_quaternion_reset();
+int test_quaternion_reset();
#endif
diff --git a/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.c b/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.c
index c152714..0d0e832 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.c
+++ b/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.c
@@ -2,7 +2,7 @@
#include "./../../helpers.h"
-int test_bgc_quaternion_set_to_identity_fp32()
+int test_quaternion_set_to_identity_fp32()
{
BgcQuaternionFP32 vector;
@@ -20,7 +20,7 @@ int test_bgc_quaternion_set_to_identity_fp32()
return TEST_SUCCES;
}
-int test_bgc_quaternion_set_to_identity_fp64()
+int test_quaternion_set_to_identity_fp64()
{
BgcQuaternionFP64 vector;
@@ -38,13 +38,13 @@ int test_bgc_quaternion_set_to_identity_fp64()
return TEST_SUCCES;
}
-int test_bgc_quaternion_set_to_identity()
+int test_quaternion_set_to_identity()
{
- if (test_bgc_quaternion_set_to_identity_fp32() != TEST_SUCCES) {
+ if (test_quaternion_set_to_identity_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_set_to_identity_fp64() != TEST_SUCCES) {
+ if (test_quaternion_set_to_identity_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.h b/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.h
index d680a69..b6f9776 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.h
+++ b/basic-geometry-test/tests/quaternion/quaternion_set_to_identity.h
@@ -1,10 +1,10 @@
#ifndef _TEST_QUATERNION_SET_TO_IDENTITY_H_
#define _TEST_QUATERNION_SET_TO_IDENTITY_H_
-int test_bgc_quaternion_set_to_identity_fp32();
+int test_quaternion_set_to_identity_fp32();
-int test_bgc_quaternion_set_to_identity_fp64();
+int test_quaternion_set_to_identity_fp64();
-int test_bgc_quaternion_set_to_identity();
+int test_quaternion_set_to_identity();
#endif
diff --git a/basic-geometry-test/tests/quaternion/quaternion_set_values.c b/basic-geometry-test/tests/quaternion/quaternion_set_values.c
index 9117996..dac6c02 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_set_values.c
+++ b/basic-geometry-test/tests/quaternion/quaternion_set_values.c
@@ -6,7 +6,7 @@
// ==================== FP32 ==================== //
-int test_bgc_quaternion_set_values_fp32()
+int test_quaternion_set_values_fp32()
{
BgcQuaternionFP32 vector;
@@ -40,7 +40,7 @@ int test_bgc_quaternion_set_values_fp32()
// ==================== FP64 ==================== //
-int test_bgc_quaternion_set_values_fp64()
+int test_quaternion_set_values_fp64()
{
BgcQuaternionFP64 vector;
@@ -72,13 +72,13 @@ int test_bgc_quaternion_set_values_fp64()
return TEST_SUCCES;
}
-int test_bgc_quaternion_set_values()
+int test_quaternion_set_values()
{
- if (test_bgc_quaternion_set_values_fp32() != TEST_SUCCES) {
+ if (test_quaternion_set_values_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_set_values_fp64() != TEST_SUCCES) {
+ if (test_quaternion_set_values_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_set_values.h b/basic-geometry-test/tests/quaternion/quaternion_set_values.h
index 25eab6d..2011b8e 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_set_values.h
+++ b/basic-geometry-test/tests/quaternion/quaternion_set_values.h
@@ -1,10 +1,10 @@
#ifndef _TEST_QUATERNION_SET_VALUES_H_
#define _TEST_QUATERNION_SET_VALUES_H_
-int test_bgc_quaternion_set_values_fp32();
+int test_quaternion_set_values_fp32();
-int test_bgc_quaternion_set_values_fp64();
+int test_quaternion_set_values_fp64();
-int test_bgc_quaternion_set_values();
+int test_quaternion_set_values();
#endif
diff --git a/basic-geometry-test/tests/quaternion/quaternion_swap.c b/basic-geometry-test/tests/quaternion/quaternion_swap.c
index e02c2d7..2ca6bab 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_swap.c
+++ b/basic-geometry-test/tests/quaternion/quaternion_swap.c
@@ -22,7 +22,7 @@ static const BgcQuaternionFP32 _TEST_FP32_QUATERNION_LIST2[] = {
{ 1000.0f, -0.00025f, -0.419f, 0.844f }
};
-int test_bgc_quaternion_swap_fp32()
+int test_quaternion_swap_fp32()
{
BgcQuaternionFP32 quaternion1, quaternion2;
@@ -70,7 +70,7 @@ static const BgcQuaternionFP64 _TEST_FP64_QUATERNION_LIST2[] = {
{ 1000.0, -0.00025, -0.419, 0.844 }
};
-int test_bgc_quaternion_swap_fp64()
+int test_quaternion_swap_fp64()
{
BgcQuaternionFP64 quaternion1, quaternion2;
@@ -100,13 +100,13 @@ int test_bgc_quaternion_swap_fp64()
return TEST_SUCCES;
}
-int test_bgc_quaternion_swap()
+int test_quaternion_swap()
{
- if (test_bgc_quaternion_swap_fp32() != TEST_SUCCES) {
+ if (test_quaternion_swap_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_quaternion_swap_fp64() != TEST_SUCCES) {
+ if (test_quaternion_swap_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/quaternion/quaternion_swap.h b/basic-geometry-test/tests/quaternion/quaternion_swap.h
index 639c771..470047d 100644
--- a/basic-geometry-test/tests/quaternion/quaternion_swap.h
+++ b/basic-geometry-test/tests/quaternion/quaternion_swap.h
@@ -1,10 +1,10 @@
#ifndef _TEST_QUATERNION_SWAP_H_
#define _TEST_QUATERNION_SWAP_H_
-int test_bgc_quaternion_swap_fp32();
+int test_quaternion_swap_fp32();
-int test_bgc_quaternion_swap_fp64();
+int test_quaternion_swap_fp64();
-int test_bgc_quaternion_swap();
+int test_quaternion_swap();
#endif
diff --git a/basic-geometry-test/tests/utilities.c b/basic-geometry-test/tests/utilities.c
index a29318d..95662dd 100644
--- a/basic-geometry-test/tests/utilities.c
+++ b/basic-geometry-test/tests/utilities.c
@@ -6,15 +6,15 @@ int test_utilities()
{
print_testing_section("BGC Utilities");
- if (test_bgc_is_zero() != TEST_SUCCES) {
+ if (test_is_zero() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_is_unit() != TEST_SUCCES) {
+ if (test_is_unit() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_are_close() != TEST_SUCCES) {
+ if (test_are_close() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/utilities/are_close.c b/basic-geometry-test/tests/utilities/are_close.c
index 5810f69..80f4c92 100644
--- a/basic-geometry-test/tests/utilities/are_close.c
+++ b/basic-geometry-test/tests/utilities/are_close.c
@@ -61,7 +61,7 @@ static const _TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
{-100.0f, -100.0f * (1.0f - 1.25f * BGC_EPSYLON_FP32)}
};
-int test_bgc_are_close_fp32()
+int test_are_close_fp32()
{
print_testing_name("bgc_are_close_fp32");
@@ -137,7 +137,7 @@ static const _TestNumberPairFP64 _TEST_FP64_DATA_DIFFERENT[] = {
{-100.0, -100.0 * (1.0 - 1.25 * BGC_EPSYLON_FP64)}
};
-int test_bgc_are_close_fp64()
+int test_are_close_fp64()
{
print_testing_name("bgc_are_close_fp64");
@@ -162,13 +162,13 @@ int test_bgc_are_close_fp64()
return TEST_SUCCES;
}
-int test_bgc_are_close()
+int test_are_close()
{
- if (test_bgc_are_close_fp32() != TEST_SUCCES) {
+ if (test_are_close_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_are_close_fp64() != TEST_SUCCES) {
+ if (test_are_close_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/utilities/are_close.h b/basic-geometry-test/tests/utilities/are_close.h
index 27e5540..e99aa38 100644
--- a/basic-geometry-test/tests/utilities/are_close.h
+++ b/basic-geometry-test/tests/utilities/are_close.h
@@ -1,10 +1,10 @@
#ifndef _TEST_UTILITIES_ARE_CLOSE_H_
#define _TEST_UTILITIES_ARE_CLOSE_H_
-int test_bgc_are_close_fp32();
+int test_are_close_fp32();
-int test_bgc_are_close_fp64();
+int test_are_close_fp64();
-int test_bgc_are_close();
+int test_are_close();
#endif
diff --git a/basic-geometry-test/tests/utilities/is_unit.c b/basic-geometry-test/tests/utilities/is_unit.c
index b4f3be1..1d1433e 100644
--- a/basic-geometry-test/tests/utilities/is_unit.c
+++ b/basic-geometry-test/tests/utilities/is_unit.c
@@ -20,7 +20,7 @@ static const float _TEST_FP32_NONUNIT_NUMBERS[] = {
1.0f - 2.0f * BGC_EPSYLON_FP32
};
-int test_bgc_is_unit_fp32()
+int test_is_unit_fp32()
{
print_testing_name("bgc_is_unit_fp32");
@@ -63,7 +63,7 @@ static const double _TEST_FP64_NONUNIT_NUMBERS[] = {
1.0 - 2.0 * BGC_EPSYLON_FP64
};
-int test_bgc_is_unit_fp64()
+int test_is_unit_fp64()
{
print_testing_name("bgc_is_unit_fp64");
@@ -108,7 +108,7 @@ static const float _TEST_FP32_DATA_SQUARE_NONUNIT[] = {
1.0f - 2.5f * BGC_EPSYLON_FP32
};
-int test_bgc_is_sqare_value_unit_fp32()
+int test_is_sqare_value_unit_fp32()
{
print_testing_name("bgc_is_sqare_value_unit_fp32");
@@ -153,7 +153,7 @@ static const double _TEST_FP64_DATA_SQUARE_NONUNIT[] = {
1.0 - 2.5 * BGC_EPSYLON_FP64
};
-int test_bgc_is_sqare_value_unit_fp64()
+int test_is_sqare_value_unit_fp64()
{
print_testing_name("bgc_is_sqare_value_unit_fp64");
@@ -178,21 +178,21 @@ int test_bgc_is_sqare_value_unit_fp64()
return TEST_SUCCES;
}
-int test_bgc_is_unit()
+int test_is_unit()
{
- if (test_bgc_is_unit_fp32() != TEST_SUCCES) {
+ if (test_is_unit_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_is_unit_fp64() != TEST_SUCCES) {
+ if (test_is_unit_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_is_sqare_value_unit_fp32() != TEST_SUCCES) {
+ if (test_is_sqare_value_unit_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_is_sqare_value_unit_fp64() != TEST_SUCCES) {
+ if (test_is_sqare_value_unit_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/utilities/is_unit.h b/basic-geometry-test/tests/utilities/is_unit.h
index 5815ab2..4f8eb44 100644
--- a/basic-geometry-test/tests/utilities/is_unit.h
+++ b/basic-geometry-test/tests/utilities/is_unit.h
@@ -1,14 +1,14 @@
#ifndef _TEST_UTILITIES_IS_UNIT_H_
#define _TEST_UTILITIES_IS_UNIT_H_
-int test_bgc_is_unit_fp32();
+int test_is_unit_fp32();
-int test_bgc_is_unit_fp64();
+int test_is_unit_fp64();
-int test_bgc_is_sqare_value_unit_fp32();
+int test_is_sqare_value_unit_fp32();
-int test_bgc_is_sqare_value_unit_fp64();
+int test_is_sqare_value_unit_fp64();
-int test_bgc_is_unit();
+int test_is_unit();
#endif
diff --git a/basic-geometry-test/tests/utilities/is_zero.c b/basic-geometry-test/tests/utilities/is_zero.c
index 731b78f..aebbd39 100644
--- a/basic-geometry-test/tests/utilities/is_zero.c
+++ b/basic-geometry-test/tests/utilities/is_zero.c
@@ -22,7 +22,7 @@ static const float _TEST_FP32_NONZERO_NUMBERS[] = {
-(1.5f * BGC_EPSYLON_FP32)
};
-int test_bgc_is_zero_fp32()
+int test_is_zero_fp32()
{
print_testing_name("bgc_is_zero_fp32");
@@ -67,7 +67,7 @@ static const double _TEST_FP64_NONZERO_NUMBERS[] = {
-(1.5 * BGC_EPSYLON_FP64)
};
-int test_bgc_is_zero_fp64()
+int test_is_zero_fp64()
{
print_testing_name("bgc_is_zero_fp64");
@@ -92,13 +92,13 @@ int test_bgc_is_zero_fp64()
return TEST_SUCCES;
}
-int test_bgc_is_zero()
+int test_is_zero()
{
- if (test_bgc_is_zero_fp32() != TEST_SUCCES) {
+ if (test_is_zero_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_is_zero_fp64() != TEST_SUCCES) {
+ if (test_is_zero_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/utilities/is_zero.h b/basic-geometry-test/tests/utilities/is_zero.h
index 38f73d7..c62077e 100644
--- a/basic-geometry-test/tests/utilities/is_zero.h
+++ b/basic-geometry-test/tests/utilities/is_zero.h
@@ -1,10 +1,10 @@
#ifndef _TEST_UTILITIES_IS_ZERO_H_
#define _TEST_UTILITIES_IS_ZERO_H_
-int test_bgc_is_zero_fp32();
+int test_is_zero_fp32();
-int test_bgc_is_zero_fp64();
+int test_is_zero_fp64();
-int test_bgc_is_zero();
+int test_is_zero();
#endif
diff --git a/basic-geometry-test/tests/vector2.c b/basic-geometry-test/tests/vector2.c
index ef5aef7..ca84171 100644
--- a/basic-geometry-test/tests/vector2.c
+++ b/basic-geometry-test/tests/vector2.c
@@ -4,23 +4,27 @@ int test_vector2()
{
print_testing_section("BGC Vector2");
- if (test_bgc_vector2_reset() != TEST_SUCCES) {
+ if (test_vector2_reset() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_set_values() != TEST_SUCCES) {
+ if (test_vector2_set_values() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_copy() != TEST_SUCCES) {
+ if (test_vector2_copy() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_swap() != TEST_SUCCES) {
+ if (test_vector2_swap() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_is_zero() != TEST_SUCCES) {
+ if (test_vector2_is_zero() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_vector2_is_unit() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector2.h b/basic-geometry-test/tests/vector2.h
index a9060c6..631e1e9 100644
--- a/basic-geometry-test/tests/vector2.h
+++ b/basic-geometry-test/tests/vector2.h
@@ -7,6 +7,7 @@
#include "./vector2/vector2_copy.h"
#include "./vector2/vector2_swap.h"
#include "./vector2/vector2_is_zero.h"
+#include "./vector2/vector2_is_unit.h"
/*
int test_fp32_vector2();
diff --git a/basic-geometry-test/tests/vector2/vector2_copy.c b/basic-geometry-test/tests/vector2/vector2_copy.c
index 9c64ec0..3af5b9d 100644
--- a/basic-geometry-test/tests/vector2/vector2_copy.c
+++ b/basic-geometry-test/tests/vector2/vector2_copy.c
@@ -14,7 +14,7 @@ static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST[] = {
{ -100.0f, 100.0f }
};
-int test_bgc_vector2_copy_fp32()
+int test_vector2_copy_fp32()
{
BgcVector2FP32 vector;
@@ -45,7 +45,7 @@ static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST[] = {
{ -100.0, 100.0 }
};
-int test_bgc_vector2_copy_fp64()
+int test_vector2_copy_fp64()
{
BgcVector2FP64 vector;
@@ -66,13 +66,13 @@ int test_bgc_vector2_copy_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector2_copy()
+int test_vector2_copy()
{
- if (test_bgc_vector2_copy_fp32() != TEST_SUCCES) {
+ if (test_vector2_copy_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_copy_fp64() != TEST_SUCCES) {
+ if (test_vector2_copy_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector2/vector2_copy.h b/basic-geometry-test/tests/vector2/vector2_copy.h
index 42f522c..c3a2cb7 100644
--- a/basic-geometry-test/tests/vector2/vector2_copy.h
+++ b/basic-geometry-test/tests/vector2/vector2_copy.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR2_COPY_H_
#define _TEST_VECTOR2_COPY_H_
-int test_bgc_vector2_copy_fp32();
+int test_vector2_copy_fp32();
-int test_bgc_vector2_copy_fp64();
+int test_vector2_copy_fp64();
-int test_bgc_vector2_copy();
+int test_vector2_copy();
#endif
diff --git a/basic-geometry-test/tests/vector2/vector2_is_unit.c b/basic-geometry-test/tests/vector2/vector2_is_unit.c
new file mode 100644
index 0000000..b376adc
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_is_unit.c
@@ -0,0 +1,114 @@
+#include "./vector2_is_unit.h"
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_UNIT_VECTOR2_AMOUNT = 6;
+static const int _TEST_FP32_NONUNIT_VECTOR2_AMOUNT = 7;
+
+static const BgcVector2FP32 _TEST_FP32_UNIT_VECTOR2_LIST[] = {
+ { 1.0f, 0.0f },
+ { 0.0f, -1.0f },
+ { 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f },
+ { 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 },
+ { 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 }
+};
+
+static const BgcVector2FP32 _TEST_FP32_NONUNIT_VECTOR2_LIST[] = {
+ { 0.0f, 0.0f },
+ { 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 },
+ { 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 },
+ { 0.8f + 1.25f * BGC_EPSYLON_FP32, 0.6f + 1.25f * BGC_EPSYLON_FP32 },
+ { 0.6f - 1.25f * BGC_EPSYLON_FP32, 0.8f - 1.25f * BGC_EPSYLON_FP32 }
+};
+
+int test_vector2_is_unit_fp32()
+{
+ print_testing_name("bgc_vector2_is_unit_fp32");
+
+ // Testing zero values:
+ for (int i = 0; i < _TEST_FP32_UNIT_VECTOR2_AMOUNT; i++) {
+ if (!bgc_vector2_is_unit_fp32(&_TEST_FP32_UNIT_VECTOR2_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ // Testing non-zero values:
+ for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR2_AMOUNT; i++) {
+ if (bgc_vector2_is_unit_fp32(&_TEST_FP32_NONUNIT_VECTOR2_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_UNIT_VECTOR2_AMOUNT = 6;
+static const int _TEST_FP64_NONUNIT_VECTOR2_AMOUNT = 7;
+
+static const BgcVector2FP64 _TEST_FP64_UNIT_VECTOR2_LIST[] = {
+ { -1.0, 0.0 },
+ { 0.0, 1.0 },
+ { 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 },
+ { 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 },
+ { 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 }
+};
+
+static const BgcVector2FP64 _TEST_FP64_NONUNIT_VECTOR2_LIST[] = {
+ { 0.0, 0.0 },
+ { 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 },
+ { 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 },
+ { 0.6 + 1.25 * BGC_EPSYLON_FP64, 0.8 + 1.25 * BGC_EPSYLON_FP64 },
+ { 0.8 - 1.25 * BGC_EPSYLON_FP64, 0.6 - 1.25 * BGC_EPSYLON_FP64 }
+};
+
+int test_vector2_is_unit_fp64()
+{
+ print_testing_name("bgc_vector2_is_unit_fp64");
+
+ // Testing zero values:
+ for (int i = 0; i < _TEST_FP64_UNIT_VECTOR2_AMOUNT; i++) {
+ if (!bgc_vector2_is_unit_fp64(&_TEST_FP64_UNIT_VECTOR2_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ // Testing non-zero values:
+ for (int i = 0; i < _TEST_FP64_NONUNIT_VECTOR2_AMOUNT; i++) {
+ if (bgc_vector2_is_unit_fp64(&_TEST_FP64_NONUNIT_VECTOR2_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+int test_vector2_is_unit()
+{
+ if (test_vector2_is_unit_fp32() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_vector2_is_unit_fp64() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/vector2/vector2_is_unit.h b/basic-geometry-test/tests/vector2/vector2_is_unit.h
new file mode 100644
index 0000000..807aa20
--- /dev/null
+++ b/basic-geometry-test/tests/vector2/vector2_is_unit.h
@@ -0,0 +1,10 @@
+#ifndef _TEST_VECTOR2_IS_UNIT_H_
+#define _TEST_VECTOR2_IS_UNIT_H_
+
+int test_vector2_is_unit_fp32();
+
+int test_vector2_is_unit_fp64();
+
+int test_vector2_is_unit();
+
+#endif
diff --git a/basic-geometry-test/tests/vector2/vector2_is_zero.c b/basic-geometry-test/tests/vector2/vector2_is_zero.c
index ac3cee1..8201783 100644
--- a/basic-geometry-test/tests/vector2/vector2_is_zero.c
+++ b/basic-geometry-test/tests/vector2/vector2_is_zero.c
@@ -4,42 +4,42 @@
// ==================== FP32 ==================== //
-static const int _TEST_FP32_ZERO_QUATERNION_AMOUNT = 5;
-static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 7;
+static const int _TEST_FP32_ZERO_VECTOR2_AMOUNT = 5;
+static const int _TEST_FP32_NONZERO_VECTOR2_AMOUNT = 7;
-static const BgcVector2FP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = {
+static const BgcVector2FP32 _TEST_FP32_ZERO_VECTOR2_LIST[] = {
{ 0.0f, 0.0f },
- { BGC_EPSYLON_FP32, 0.0f },
- { -BGC_EPSYLON_FP32, 0.0f },
- { 0.0f, BGC_EPSYLON_FP32 },
- { 0.0f, -BGC_EPSYLON_FP32 }
+ { 0.75f * BGC_EPSYLON_FP32, 0.0f },
+ { -0.75f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 0.75f * BGC_EPSYLON_FP32 },
+ { 0.0f, -0.75f * BGC_EPSYLON_FP32 }
};
-static const BgcVector2FP32 _TEST_FP32_NONZERO_NUMBERS[] = {
+static const BgcVector2FP32 _TEST_FP32_NONZERO_VECTOR2_LIST[] = {
{ 0.0f, 1.0f },
- { 1.5f * BGC_EPSYLON_FP32, 0.0f },
- { -1.5f * BGC_EPSYLON_FP32, 0.0f },
- { 0.0f, 1.5f * BGC_EPSYLON_FP32 },
- { 0.0f, -1.5f * BGC_EPSYLON_FP32 },
+ { 1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { -1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 1.25f * BGC_EPSYLON_FP32 },
+ { 0.0f, -1.25f * BGC_EPSYLON_FP32 },
{ BGC_EPSYLON_FP32, BGC_EPSYLON_FP32 },
{ -BGC_EPSYLON_FP32, -BGC_EPSYLON_FP32 }
};
-int test_bgc_vector2_is_zero_fp32()
+int test_vector2_is_zero_fp32()
{
print_testing_name("bgc_vector2_is_zero_fp32");
// Testing zero values:
- for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) {
- if (!bgc_vector2_is_zero_fp32(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) {
+ for (int i = 0; i < _TEST_FP32_ZERO_VECTOR2_AMOUNT; i++) {
+ if (!bgc_vector2_is_zero_fp32(&_TEST_FP32_ZERO_VECTOR2_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
}
// Testing non-zero values:
- for (int i = 0; i < _TEST_FP32_NONZERO_QUATERNION_AMOUNT; i++) {
- if (bgc_vector2_is_zero_fp32(&_TEST_FP32_NONZERO_NUMBERS[i])) {
+ for (int i = 0; i < _TEST_FP32_NONZERO_VECTOR2_AMOUNT; i++) {
+ if (bgc_vector2_is_zero_fp32(&_TEST_FP32_NONZERO_VECTOR2_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
@@ -52,42 +52,42 @@ int test_bgc_vector2_is_zero_fp32()
// ==================== FP64 ==================== //
-static const int _TEST_FP64_ZERO_QUATERNION_AMOUNT = 5;
-static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 7;
+static const int _TEST_FP64_ZERO_VECTOR2_AMOUNT = 5;
+static const int _TEST_FP64_NONZERO_VECTOR2_AMOUNT = 7;
-static const BgcVector2FP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = {
+static const BgcVector2FP64 _TEST_FP64_ZERO_VECTOR2_LIST[] = {
{ 0.0, 0.0 },
- { BGC_EPSYLON_FP64, 0.0 },
- { -BGC_EPSYLON_FP64, 0.0 },
- { 0.0, BGC_EPSYLON_FP64 },
- { 0.0, -BGC_EPSYLON_FP64 }
+ { 0.75 * BGC_EPSYLON_FP64, 0.0 },
+ { -0.75 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 0.75 * BGC_EPSYLON_FP64 },
+ { 0.0, -0.75 * BGC_EPSYLON_FP64 }
};
-static const BgcVector2FP64 _TEST_FP64_NONZERO_NUMBERS[] = {
+static const BgcVector2FP64 _TEST_FP64_NONZERO_VECTOR2_LIST[] = {
{ 0.0, 1.0 },
- { 1.5 * BGC_EPSYLON_FP64, 0.0 },
- { -1.5 * BGC_EPSYLON_FP64, 0.0 },
- { 0.0, 1.5 * BGC_EPSYLON_FP64 },
- { 0.0, -1.5 * BGC_EPSYLON_FP64 },
- { BGC_EPSYLON_FP64, BGC_EPSYLON_FP64 },
- { -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64 }
+ { 1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { -1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 1.25 * BGC_EPSYLON_FP64 },
+ { 0.0, -1.25 * BGC_EPSYLON_FP64 },
+ { 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64 },
+ { -1.25 * BGC_EPSYLON_FP64, -1.25 * BGC_EPSYLON_FP64 }
};
-int test_bgc_vector2_is_zero_fp64()
+int test_vector2_is_zero_fp64()
{
print_testing_name("bgc_vector2_is_zero_fp64");
// Testing zero values:
- for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) {
- if (!bgc_vector2_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) {
+ for (int i = 0; i < _TEST_FP64_ZERO_VECTOR2_AMOUNT; i++) {
+ if (!bgc_vector2_is_zero_fp64(&_TEST_FP64_ZERO_VECTOR2_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
}
// Testing non-zero values:
- for (int i = 0; i < _TEST_FP64_NONZERO_QUATERNION_AMOUNT; i++) {
- if (bgc_vector2_is_zero_fp64(&_TEST_FP64_NONZERO_NUMBERS[i])) {
+ for (int i = 0; i < _TEST_FP64_NONZERO_VECTOR2_AMOUNT; i++) {
+ if (bgc_vector2_is_zero_fp64(&_TEST_FP64_NONZERO_VECTOR2_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
@@ -98,13 +98,13 @@ int test_bgc_vector2_is_zero_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector2_is_zero()
+int test_vector2_is_zero()
{
- if (test_bgc_vector2_is_zero_fp32() != TEST_SUCCES) {
+ if (test_vector2_is_zero_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_is_zero_fp64() != TEST_SUCCES) {
+ if (test_vector2_is_zero_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector2/vector2_is_zero.h b/basic-geometry-test/tests/vector2/vector2_is_zero.h
index 46603e1..9f6be97 100644
--- a/basic-geometry-test/tests/vector2/vector2_is_zero.h
+++ b/basic-geometry-test/tests/vector2/vector2_is_zero.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR2_IS_ZERO_H_
#define _TEST_VECTOR2_IS_ZERO_H_
-int test_bgc_vector2_is_zero_fp32();
+int test_vector2_is_zero_fp32();
-int test_bgc_vector2_is_zero_fp64();
+int test_vector2_is_zero_fp64();
-int test_bgc_vector2_is_zero();
+int test_vector2_is_zero();
#endif
diff --git a/basic-geometry-test/tests/vector2/vector2_reset.c b/basic-geometry-test/tests/vector2/vector2_reset.c
index f8a1845..131016e 100644
--- a/basic-geometry-test/tests/vector2/vector2_reset.c
+++ b/basic-geometry-test/tests/vector2/vector2_reset.c
@@ -2,7 +2,7 @@
#include "./../../helpers.h"
-int test_bgc_vector2_reset_fp32()
+int test_vector2_reset_fp32()
{
BgcVector2FP32 vector;
@@ -20,7 +20,7 @@ int test_bgc_vector2_reset_fp32()
return TEST_SUCCES;
}
-int test_bgc_vector2_reset_fp64()
+int test_vector2_reset_fp64()
{
BgcVector2FP64 vector;
@@ -38,13 +38,13 @@ int test_bgc_vector2_reset_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector2_reset()
+int test_vector2_reset()
{
- if (test_bgc_vector2_reset_fp32() != TEST_SUCCES) {
+ if (test_vector2_reset_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_reset_fp64() != TEST_SUCCES) {
+ if (test_vector2_reset_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector2/vector2_reset.h b/basic-geometry-test/tests/vector2/vector2_reset.h
index aafcaa1..fb7f153 100644
--- a/basic-geometry-test/tests/vector2/vector2_reset.h
+++ b/basic-geometry-test/tests/vector2/vector2_reset.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR2_RESET_H_
#define _TEST_VECTOR2_RESET_H_
-int test_bgc_vector2_reset_fp32();
+int test_vector2_reset_fp32();
-int test_bgc_vector2_reset_fp64();
+int test_vector2_reset_fp64();
-int test_bgc_vector2_reset();
+int test_vector2_reset();
#endif
diff --git a/basic-geometry-test/tests/vector2/vector2_set_values.c b/basic-geometry-test/tests/vector2/vector2_set_values.c
index fa08e6c..3efe38f 100644
--- a/basic-geometry-test/tests/vector2/vector2_set_values.c
+++ b/basic-geometry-test/tests/vector2/vector2_set_values.c
@@ -6,7 +6,7 @@
// ==================== FP32 ==================== //
-int test_bgc_vector2_set_values_fp32()
+int test_vector2_set_values_fp32()
{
BgcVector2FP32 vector;
@@ -40,7 +40,7 @@ int test_bgc_vector2_set_values_fp32()
// ==================== FP64 ==================== //
-int test_bgc_vector2_set_values_fp64()
+int test_vector2_set_values_fp64()
{
BgcVector2FP64 vector;
@@ -73,13 +73,13 @@ int test_bgc_vector2_set_values_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector2_set_values()
+int test_vector2_set_values()
{
- if (test_bgc_vector2_set_values_fp32() != TEST_SUCCES) {
+ if (test_vector2_set_values_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_set_values_fp64() != TEST_SUCCES) {
+ if (test_vector2_set_values_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector2/vector2_set_values.h b/basic-geometry-test/tests/vector2/vector2_set_values.h
index 8ac66aa..14f2467 100644
--- a/basic-geometry-test/tests/vector2/vector2_set_values.h
+++ b/basic-geometry-test/tests/vector2/vector2_set_values.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR2_SET_VALUES_H_
#define _TEST_VECTOR2_SET_VALUES_H_
-int test_bgc_vector2_set_values_fp32();
+int test_vector2_set_values_fp32();
-int test_bgc_vector2_set_values_fp64();
+int test_vector2_set_values_fp64();
-int test_bgc_vector2_set_values();
+int test_vector2_set_values();
#endif
diff --git a/basic-geometry-test/tests/vector2/vector2_swap.c b/basic-geometry-test/tests/vector2/vector2_swap.c
index 744acba..420a781 100644
--- a/basic-geometry-test/tests/vector2/vector2_swap.c
+++ b/basic-geometry-test/tests/vector2/vector2_swap.c
@@ -22,7 +22,7 @@ static const BgcVector2FP32 _TEST_FP32_VECTOR2_LIST2[] = {
{ 1000.0f, -0.00025f }
};
-int test_bgc_vector2_swap_fp32()
+int test_vector2_swap_fp32()
{
BgcVector2FP32 vector1, vector2;
@@ -66,7 +66,7 @@ static const BgcVector2FP64 _TEST_FP64_VECTOR2_LIST2[] = {
{ 1000.0, -0.00025 }
};
-int test_bgc_vector2_swap_fp64()
+int test_vector2_swap_fp64()
{
BgcVector2FP64 vector1, vector2;
@@ -92,13 +92,13 @@ int test_bgc_vector2_swap_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector2_swap()
+int test_vector2_swap()
{
- if (test_bgc_vector2_swap_fp32() != TEST_SUCCES) {
+ if (test_vector2_swap_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector2_swap_fp64() != TEST_SUCCES) {
+ if (test_vector2_swap_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector2/vector2_swap.h b/basic-geometry-test/tests/vector2/vector2_swap.h
index 46369f0..c256c55 100644
--- a/basic-geometry-test/tests/vector2/vector2_swap.h
+++ b/basic-geometry-test/tests/vector2/vector2_swap.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR2_SWAP_H_
#define _TEST_VECTOR2_SWAP_H_
-int test_bgc_vector2_swap_fp32();
+int test_vector2_swap_fp32();
-int test_bgc_vector2_swap_fp64();
+int test_vector2_swap_fp64();
-int test_bgc_vector2_swap();
+int test_vector2_swap();
#endif
diff --git a/basic-geometry-test/tests/vector3.c b/basic-geometry-test/tests/vector3.c
index a85d11a..71e21f3 100644
--- a/basic-geometry-test/tests/vector3.c
+++ b/basic-geometry-test/tests/vector3.c
@@ -4,23 +4,27 @@ int test_vector3()
{
print_testing_section("BGC Vector3");
- if (test_bgc_vector3_reset() != TEST_SUCCES) {
+ if (test_vector3_reset() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_set_values() != TEST_SUCCES) {
+ if (test_vector3_set_values() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_copy() != TEST_SUCCES) {
+ if (test_vector3_copy() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_swap() != TEST_SUCCES) {
+ if (test_vector3_swap() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_is_zero() != TEST_SUCCES) {
+ if (test_vector3_is_zero() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_vector3_is_unit() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector3.h b/basic-geometry-test/tests/vector3.h
index 92943d1..40d094b 100644
--- a/basic-geometry-test/tests/vector3.h
+++ b/basic-geometry-test/tests/vector3.h
@@ -7,6 +7,7 @@
#include "./vector3/vector3_copy.h"
#include "./vector3/vector3_swap.h"
#include "./vector3/vector3_is_zero.h"
+#include "./vector3/vector3_is_unit.h"
int test_vector3();
diff --git a/basic-geometry-test/tests/vector3/vector3_copy.c b/basic-geometry-test/tests/vector3/vector3_copy.c
index e546455..d88736a 100644
--- a/basic-geometry-test/tests/vector3/vector3_copy.c
+++ b/basic-geometry-test/tests/vector3/vector3_copy.c
@@ -14,7 +14,7 @@ static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST[] = {
{ -100.0f, 100.0f, -0.001f }
};
-int test_bgc_vector3_copy_fp32()
+int test_vector3_copy_fp32()
{
BgcVector3FP32 vector;
@@ -47,7 +47,7 @@ static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST[] = {
{ -100.0, 100.0, -0.001 }
};
-int test_bgc_vector3_copy_fp64()
+int test_vector3_copy_fp64()
{
BgcVector3FP64 vector;
@@ -70,13 +70,13 @@ int test_bgc_vector3_copy_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector3_copy()
+int test_vector3_copy()
{
- if (test_bgc_vector3_copy_fp32() != TEST_SUCCES) {
+ if (test_vector3_copy_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_copy_fp64() != TEST_SUCCES) {
+ if (test_vector3_copy_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector3/vector3_copy.h b/basic-geometry-test/tests/vector3/vector3_copy.h
index 100a7e3..c250c5a 100644
--- a/basic-geometry-test/tests/vector3/vector3_copy.h
+++ b/basic-geometry-test/tests/vector3/vector3_copy.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR3_COPY_H_
#define _TEST_VECTOR3_COPY_H_
-int test_bgc_vector3_copy_fp32();
+int test_vector3_copy_fp32();
-int test_bgc_vector3_copy_fp64();
+int test_vector3_copy_fp64();
-int test_bgc_vector3_copy();
+int test_vector3_copy();
#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_is_unit.c b/basic-geometry-test/tests/vector3/vector3_is_unit.c
new file mode 100644
index 0000000..c684986
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_is_unit.c
@@ -0,0 +1,126 @@
+#include "./vector3_is_unit.h"
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_UNIT_VECTOR3_AMOUNT = 10;
+static const int _TEST_FP32_NONUNIT_VECTOR3_AMOUNT = 9;
+
+static const BgcVector3FP32 _TEST_FP32_UNIT_VECTOR3_LIST[] = {
+ { 1.0f, 0.0f, 0.0f },
+ { 0.0f, -1.0f, 0.0f },
+ { 0.0f, -0.8f, 0.6f },
+ { -0.6f, 0.0f, 0.8f },
+ { 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { 0.0f, -1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, -1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 },
+ { 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 }
+};
+
+static const BgcVector3FP32 _TEST_FP32_NONUNIT_VECTOR3_LIST[] = {
+ { 0.0f, 0.0f, 0.0f },
+ { 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 },
+ { 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 },
+ { 0.8f + 1.25f * BGC_EPSYLON_FP32, -0.6f - 1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.6f - 1.25f * BGC_EPSYLON_FP32, -0.8f + 1.25f * BGC_EPSYLON_FP32, 0.0f }
+};
+
+int test_vector3_is_unit_fp32()
+{
+ print_testing_name("bgc_vector3_is_unit_fp32");
+
+ // Testing zero values:
+ for (int i = 0; i < _TEST_FP32_UNIT_VECTOR3_AMOUNT; i++) {
+ if (!bgc_vector3_is_unit_fp32(&_TEST_FP32_UNIT_VECTOR3_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ // Testing non-zero values:
+ for (int i = 0; i < _TEST_FP32_NONUNIT_VECTOR3_AMOUNT; i++) {
+ if (bgc_vector3_is_unit_fp32(&_TEST_FP32_NONUNIT_VECTOR3_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_UNIT_VECTOR3_AMOUNT = 10;
+static const int _TEST_FP64_NONUNIT_VECTOR3_AMOUNT = 9;
+
+static const BgcVector3FP64 _TEST_FP64_UNIT_VECTOR3_LIST[] = {
+ { 1.0, 0.0, 0.0 },
+ { 0.0, -1.0, 0.0 },
+ { 0.0, -0.8, 0.6 },
+ { -0.6, 0.0, 0.8 },
+ { 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { 0.0, -1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, -1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 },
+ { 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 }
+};
+
+static const BgcVector3FP64 _TEST_FP64_NONUNIT_VECTOR3_LIST[] = {
+ { 0.0, 0.0, 0.0 },
+ { 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 },
+ { 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 },
+ { 0.8 + 1.25 * BGC_EPSYLON_FP64, -0.6 - 1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.6 - 1.25 * BGC_EPSYLON_FP64, -0.8 + 1.25 * BGC_EPSYLON_FP64, 0.0 }
+};
+
+int test_vector3_is_unit_fp64()
+{
+ print_testing_name("bgc_vector3_is_unit_fp64");
+
+ // Testing zero values:
+ for (int i = 0; i < _TEST_FP64_UNIT_VECTOR3_AMOUNT; i++) {
+ if (!bgc_vector3_is_unit_fp64(&_TEST_FP64_UNIT_VECTOR3_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ // Testing non-zero values:
+ for (int i = 0; i < _TEST_FP64_NONUNIT_VECTOR3_AMOUNT; i++) {
+ if (bgc_vector3_is_unit_fp64(&_TEST_FP64_NONUNIT_VECTOR3_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+int test_vector3_is_unit()
+{
+ if (test_vector3_is_unit_fp32() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_vector3_is_unit_fp64() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/vector3/vector3_is_unit.h b/basic-geometry-test/tests/vector3/vector3_is_unit.h
new file mode 100644
index 0000000..c899570
--- /dev/null
+++ b/basic-geometry-test/tests/vector3/vector3_is_unit.h
@@ -0,0 +1,10 @@
+#ifndef _TEST_VECTOR3_IS_UNIT_H_
+#define _TEST_VECTOR3_IS_UNIT_H_
+
+int test_vector3_is_unit_fp32();
+
+int test_vector3_is_unit_fp64();
+
+int test_vector3_is_unit();
+
+#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_is_zero.c b/basic-geometry-test/tests/vector3/vector3_is_zero.c
index 1ec9eda..987dedc 100644
--- a/basic-geometry-test/tests/vector3/vector3_is_zero.c
+++ b/basic-geometry-test/tests/vector3/vector3_is_zero.c
@@ -4,46 +4,46 @@
// ==================== FP32 ==================== //
-static const int _TEST_FP32_ZERO_QUATERNION_AMOUNT = 7;
-static const int _TEST_FP32_NONZERO_QUATERNION_AMOUNT = 9;
+static const int _TEST_FP32_ZERO_VECTOR3_AMOUNT = 7;
+static const int _TEST_FP32_NONZERO_VECTOR3_AMOUNT = 9;
-static const BgcVector3FP32 _TEST_FP32_ZERO_QUATERNION_LIST[] = {
+static const BgcVector3FP32 _TEST_FP32_ZERO_VECTOR3_LIST[] = {
{ 0.0f, 0.0f, 0.0f },
- { BGC_EPSYLON_FP32, 0.0f, 0.0f },
- { -BGC_EPSYLON_FP32, 0.0f, 0.0f },
- { 0.0f, BGC_EPSYLON_FP32, 0.0f },
- { 0.0f, -BGC_EPSYLON_FP32, 0.0f },
- { 0.0f, 0.0f, BGC_EPSYLON_FP32 },
- { 0.0f, 0.0f, -BGC_EPSYLON_FP32 }
+ { 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { -0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { 0.0f, 0.75f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, -0.75f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 0.0f, 0.75f * BGC_EPSYLON_FP32 },
+ { 0.0f, 0.0f, -0.75f * BGC_EPSYLON_FP32 }
};
-static const BgcVector3FP32 _TEST_FP32_NONZERO_NUMBERS[] = {
+static const BgcVector3FP32 _TEST_FP32_NONZERO_VECTOR3_LIST[] = {
{ 0.0f, 1.0f, 0.0f },
- { 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
- { -1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
- { 0.0f, 1.5f * BGC_EPSYLON_FP32, 0.0f },
- { 0.0f, -1.5f * BGC_EPSYLON_FP32, 0.0f },
- { 0.0f, 0.0f, 1.5f * BGC_EPSYLON_FP32 },
- { 0.0f, 0.0f, -1.5f * BGC_EPSYLON_FP32 },
- { BGC_EPSYLON_FP32, BGC_EPSYLON_FP32, 0.0f },
- { -BGC_EPSYLON_FP32, -BGC_EPSYLON_FP32, 0.0f }
+ { 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { -1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { 0.0f, 1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, -1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { 0.0f, 0.0f, 1.25f * BGC_EPSYLON_FP32 },
+ { 0.0f, 0.0f, -1.25f * BGC_EPSYLON_FP32 },
+ { 1.25f * BGC_EPSYLON_FP32, 1.25f * BGC_EPSYLON_FP32, 0.0f },
+ { -1.25f * BGC_EPSYLON_FP32, -1.25f * BGC_EPSYLON_FP32, 0.0f }
};
-int test_bgc_vector3_is_zero_fp32()
+int test_vector3_is_zero_fp32()
{
print_testing_name("bgc_vector3_is_zero_fp32");
// Testing zero values:
- for (int i = 0; i < _TEST_FP32_ZERO_QUATERNION_AMOUNT; i++) {
- if (!bgc_vector3_is_zero_fp32(&_TEST_FP32_ZERO_QUATERNION_LIST[i])) {
+ for (int i = 0; i < _TEST_FP32_ZERO_VECTOR3_AMOUNT; i++) {
+ if (!bgc_vector3_is_zero_fp32(&_TEST_FP32_ZERO_VECTOR3_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
}
// Testing non-zero values:
- for (int i = 0; i < _TEST_FP32_NONZERO_QUATERNION_AMOUNT; i++) {
- if (bgc_vector3_is_zero_fp32(&_TEST_FP32_NONZERO_NUMBERS[i])) {
+ for (int i = 0; i < _TEST_FP32_NONZERO_VECTOR3_AMOUNT; i++) {
+ if (bgc_vector3_is_zero_fp32(&_TEST_FP32_NONZERO_VECTOR3_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
@@ -56,46 +56,46 @@ int test_bgc_vector3_is_zero_fp32()
// ==================== FP64 ==================== //
-static const int _TEST_FP64_ZERO_QUATERNION_AMOUNT = 7;
-static const int _TEST_FP64_NONZERO_QUATERNION_AMOUNT = 9;
+static const int _TEST_FP64_ZERO_VECTOR3_AMOUNT = 7;
+static const int _TEST_FP64_NONZERO_VECTOR3_AMOUNT = 9;
-static const BgcVector3FP64 _TEST_FP64_ZERO_QUATERNION_LIST[] = {
+static const BgcVector3FP64 _TEST_FP64_ZERO_VECTOR3_LIST[] = {
{ 0.0, 0.0, 0.0 },
- { BGC_EPSYLON_FP64, 0.0, 0.0 },
- { -BGC_EPSYLON_FP64, 0.0, 0.0 },
- { 0.0, BGC_EPSYLON_FP64, 0.0 },
- { 0.0, -BGC_EPSYLON_FP64, 0.0 },
- { 0.0, 0.0, BGC_EPSYLON_FP64 },
- { 0.0, 0.0, -BGC_EPSYLON_FP64 }
+ { 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { -0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { 0.0, 0.75 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, -0.75 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 0.0, 0.75 * BGC_EPSYLON_FP64 },
+ { 0.0, 0.0, -0.75 * BGC_EPSYLON_FP64 }
};
-static const BgcVector3FP64 _TEST_FP64_NONZERO_NUMBERS[] = {
+static const BgcVector3FP64 _TEST_FP64_NONZERO_VECTOR3_LIST[] = {
{ 0.0, 1.0, 0.0 },
- { 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 },
- { -1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 },
- { 0.0, 1.5 * BGC_EPSYLON_FP64, 0.0 },
- { 0.0, -1.5 * BGC_EPSYLON_FP64, 0.0 },
- { 0.0, 0.0, 1.5 * BGC_EPSYLON_FP64 },
- { 0.0, 0.0, -1.5 * BGC_EPSYLON_FP64 },
- { BGC_EPSYLON_FP64, BGC_EPSYLON_FP64, 0.0 },
+ { 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { -1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { 0.0, 1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, -1.25 * BGC_EPSYLON_FP64, 0.0 },
+ { 0.0, 0.0, 1.25 * BGC_EPSYLON_FP64 },
+ { 0.0, 0.0, -1.25 * BGC_EPSYLON_FP64 },
+ { 1.25 * BGC_EPSYLON_FP64, 1.25 * BGC_EPSYLON_FP64, 0.0 },
{ -BGC_EPSYLON_FP64, -BGC_EPSYLON_FP64, 0.0 }
};
-int test_bgc_vector3_is_zero_fp64()
+int test_vector3_is_zero_fp64()
{
print_testing_name("bgc_vector3_is_zero_fp64");
// Testing zero values:
- for (int i = 0; i < _TEST_FP64_ZERO_QUATERNION_AMOUNT; i++) {
- if (!bgc_vector3_is_zero_fp64(&_TEST_FP64_ZERO_QUATERNION_LIST[i])) {
+ for (int i = 0; i < _TEST_FP64_ZERO_VECTOR3_AMOUNT; i++) {
+ if (!bgc_vector3_is_zero_fp64(&_TEST_FP64_ZERO_VECTOR3_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
}
// Testing non-zero values:
- for (int i = 0; i < _TEST_FP64_NONZERO_QUATERNION_AMOUNT; i++) {
- if (bgc_vector3_is_zero_fp64(&_TEST_FP64_NONZERO_NUMBERS[i])) {
+ for (int i = 0; i < _TEST_FP64_NONZERO_VECTOR3_AMOUNT; i++) {
+ if (bgc_vector3_is_zero_fp64(&_TEST_FP64_NONZERO_VECTOR3_LIST[i])) {
print_testing_failed();
return TEST_FAILED;
}
@@ -106,13 +106,13 @@ int test_bgc_vector3_is_zero_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector3_is_zero()
+int test_vector3_is_zero()
{
- if (test_bgc_vector3_is_zero_fp32() != TEST_SUCCES) {
+ if (test_vector3_is_zero_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_is_zero_fp64() != TEST_SUCCES) {
+ if (test_vector3_is_zero_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector3/vector3_is_zero.h b/basic-geometry-test/tests/vector3/vector3_is_zero.h
index 12dbc87..154018a 100644
--- a/basic-geometry-test/tests/vector3/vector3_is_zero.h
+++ b/basic-geometry-test/tests/vector3/vector3_is_zero.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR3_IS_ZERO_H_
#define _TEST_VECTOR3_IS_ZERO_H_
-int test_bgc_vector3_is_zero_fp32();
+int test_vector3_is_zero_fp32();
-int test_bgc_vector3_is_zero_fp64();
+int test_vector3_is_zero_fp64();
-int test_bgc_vector3_is_zero();
+int test_vector3_is_zero();
#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_reset.c b/basic-geometry-test/tests/vector3/vector3_reset.c
index 3fd29a0..0e84b7f 100644
--- a/basic-geometry-test/tests/vector3/vector3_reset.c
+++ b/basic-geometry-test/tests/vector3/vector3_reset.c
@@ -2,7 +2,7 @@
#include "./../../helpers.h"
-int test_bgc_vector3_reset_fp32()
+int test_vector3_reset_fp32()
{
BgcVector3FP32 vector;
@@ -20,7 +20,7 @@ int test_bgc_vector3_reset_fp32()
return TEST_SUCCES;
}
-int test_bgc_vector3_reset_fp64()
+int test_vector3_reset_fp64()
{
BgcVector3FP64 vector;
@@ -38,13 +38,13 @@ int test_bgc_vector3_reset_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector3_reset()
+int test_vector3_reset()
{
- if (test_bgc_vector3_reset_fp32() != TEST_SUCCES) {
+ if (test_vector3_reset_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_reset_fp64() != TEST_SUCCES) {
+ if (test_vector3_reset_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector3/vector3_reset.h b/basic-geometry-test/tests/vector3/vector3_reset.h
index c41c222..3f59af4 100644
--- a/basic-geometry-test/tests/vector3/vector3_reset.h
+++ b/basic-geometry-test/tests/vector3/vector3_reset.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR3_RESET_H_
#define _TEST_VECTOR3_RESET_H_
-int test_bgc_vector3_reset_fp32();
+int test_vector3_reset_fp32();
-int test_bgc_vector3_reset_fp64();
+int test_vector3_reset_fp64();
-int test_bgc_vector3_reset();
+int test_vector3_reset();
#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_set_values.c b/basic-geometry-test/tests/vector3/vector3_set_values.c
index 4f4eff7..8e36384 100644
--- a/basic-geometry-test/tests/vector3/vector3_set_values.c
+++ b/basic-geometry-test/tests/vector3/vector3_set_values.c
@@ -6,7 +6,7 @@
// ==================== FP32 ==================== //
-int test_bgc_vector3_set_values_fp32()
+int test_vector3_set_values_fp32()
{
BgcVector3FP32 vector;
@@ -40,7 +40,7 @@ int test_bgc_vector3_set_values_fp32()
// ==================== FP64 ==================== //
-int test_bgc_vector3_set_values_fp64()
+int test_vector3_set_values_fp64()
{
BgcVector3FP64 vector;
@@ -73,13 +73,13 @@ int test_bgc_vector3_set_values_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector3_set_values()
+int test_vector3_set_values()
{
- if (test_bgc_vector3_set_values_fp32() != TEST_SUCCES) {
+ if (test_vector3_set_values_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_set_values_fp64() != TEST_SUCCES) {
+ if (test_vector3_set_values_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector3/vector3_set_values.h b/basic-geometry-test/tests/vector3/vector3_set_values.h
index 6de5296..5d48d76 100644
--- a/basic-geometry-test/tests/vector3/vector3_set_values.h
+++ b/basic-geometry-test/tests/vector3/vector3_set_values.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR3_SET_VALUES_H_
#define _TEST_VECTOR3_SET_VALUES_H_
-int test_bgc_vector3_set_values_fp32();
+int test_vector3_set_values_fp32();
-int test_bgc_vector3_set_values_fp64();
+int test_vector3_set_values_fp64();
-int test_bgc_vector3_set_values();
+int test_vector3_set_values();
#endif
diff --git a/basic-geometry-test/tests/vector3/vector3_swap.c b/basic-geometry-test/tests/vector3/vector3_swap.c
index 23206bb..1968cd0 100644
--- a/basic-geometry-test/tests/vector3/vector3_swap.c
+++ b/basic-geometry-test/tests/vector3/vector3_swap.c
@@ -22,7 +22,7 @@ static const BgcVector3FP32 _TEST_FP32_VECTOR3_LIST2[] = {
{ 1000.0f, -0.00025f, -0.419f }
};
-int test_bgc_vector3_swap_fp32()
+int test_vector3_swap_fp32()
{
BgcVector3FP32 vector1, vector2;
@@ -68,7 +68,7 @@ static const BgcVector3FP64 _TEST_FP64_VECTOR3_LIST2[] = {
{ 1000.0, -0.00025, -0.419 }
};
-int test_bgc_vector3_swap_fp64()
+int test_vector3_swap_fp64()
{
BgcVector3FP64 vector1, vector2;
@@ -96,13 +96,13 @@ int test_bgc_vector3_swap_fp64()
return TEST_SUCCES;
}
-int test_bgc_vector3_swap()
+int test_vector3_swap()
{
- if (test_bgc_vector3_swap_fp32() != TEST_SUCCES) {
+ if (test_vector3_swap_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_vector3_swap_fp64() != TEST_SUCCES) {
+ if (test_vector3_swap_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/vector3/vector3_swap.h b/basic-geometry-test/tests/vector3/vector3_swap.h
index 94a8181..c4f7ef6 100644
--- a/basic-geometry-test/tests/vector3/vector3_swap.h
+++ b/basic-geometry-test/tests/vector3/vector3_swap.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VECTOR3_SWAP_H_
#define _TEST_VECTOR3_SWAP_H_
-int test_bgc_vector3_swap_fp32();
+int test_vector3_swap_fp32();
-int test_bgc_vector3_swap_fp64();
+int test_vector3_swap_fp64();
-int test_bgc_vector3_swap();
+int test_vector3_swap();
#endif
diff --git a/basic-geometry-test/tests/versor.c b/basic-geometry-test/tests/versor.c
index cf4e33d..f5e5e54 100644
--- a/basic-geometry-test/tests/versor.c
+++ b/basic-geometry-test/tests/versor.c
@@ -6,27 +6,31 @@ int test_versor()
{
print_testing_section("BGC Versor");
- if (test_bgc_versor_reset() != TEST_SUCCES) {
+ if (test_versor_reset() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_set_values() != TEST_SUCCES) {
+ if (test_versor_set_values() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_copy() != TEST_SUCCES) {
+ if (test_versor_copy() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_swap() != TEST_SUCCES) {
+ if (test_versor_swap() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_are_close() != TEST_SUCCES) {
+ if (test_versor_are_close() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_combine() != TEST_SUCCES) {
+ if (test_versor_is_identity() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_versor_combine() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/versor.h b/basic-geometry-test/tests/versor.h
index 7459d15..df5308d 100644
--- a/basic-geometry-test/tests/versor.h
+++ b/basic-geometry-test/tests/versor.h
@@ -6,6 +6,7 @@
#include "./versor/versor_copy.h"
#include "./versor/versor_swap.h"
#include "./versor/versor_are_close.h"
+#include "./versor/versor_is_identity.h"
#include "./versor/versor_combine.h"
int test_versor();
diff --git a/basic-geometry-test/tests/versor/versor_are_close.c b/basic-geometry-test/tests/versor/versor_are_close.c
index 1e4853b..616289e 100644
--- a/basic-geometry-test/tests/versor/versor_are_close.c
+++ b/basic-geometry-test/tests/versor/versor_are_close.c
@@ -17,35 +17,35 @@ static const int _TEST_FP32_CLOSE_VERSOR_PAIR_AMOUNT = 10;
static const _TestVersorPairFP32 _TEST_FP32_CLOSE_VERSOR_PAIR_LIST[] = {
{
{ 1.0f, 0.0f, 0.0f, 0.0f },
- { 1.0f + BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
+ { 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
},
{
{ 1.0f, 0.0f, 0.0f, 0.0f },
- { 1.0f - BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
+ { 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
},
{
{ 0.0f, 1.0f, 0.0f, 0.0f },
- { 0.0f, 1.0f + BGC_EPSYLON_FP32, 0.0f, 0.0f }
+ { 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
},
{
{ 0.0f, 1.0f, 0.0f, 0.0f },
- { 0.0f, 1.0f - BGC_EPSYLON_FP32, 0.0f, 0.0f }
+ { 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
},
{
{ 0.0f, 0.0f, 1.0f, 0.0f },
- { 0.0f, 0.0f, 1.0f + BGC_EPSYLON_FP32, 0.0f }
+ { 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32, 0.0f }
},
{
{ 0.0f, 0.0f, 1.0f, 0.0f },
- { 0.0f, 0.0f, 1.0f - BGC_EPSYLON_FP32, 0.0f }
+ { 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32, 0.0f }
},
{
{ 0.0f, 0.0f, 0.0f, 1.0f },
- { 0.0f, 0.0f, 0.0f, 1.0f + BGC_EPSYLON_FP32 }
+ { 0.0f, 0.0f, 0.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32 }
},
{
{ 0.0f, 0.0f, 0.0f, 1.0f },
- { 0.0f, 0.0f, 0.0f, 1.0f - BGC_EPSYLON_FP32 }
+ { 0.0f, 0.0f, 0.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32 }
},
{
{ 0.70710678f, 0.0f, 0.70710675f, 0.0f },
@@ -62,35 +62,35 @@ static const int _TEST_FP32_DIFFERENT_VERSOR_PAIR_AMOUNT = 10;
static const _TestVersorPairFP32 _TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[] = {
{
{ 1.0f, 0.0f, 0.0f, 0.0f },
- { 1.0f + 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
+ { 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
},
{
{ 1.0f, 0.0f, 0.0f, 0.0f },
- { 1.0f - 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
+ { 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
},
{
{ 0.0f, 1.0f, 0.0f, 0.0f },
- { 0.0f, 1.0f + 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
+ { 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
},
{
{ 0.0f, 1.0f, 0.0f, 0.0f },
- { 0.0f, 1.0f - 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
+ { 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f, 0.0f }
},
{
{ 0.0f, 0.0f, 1.0f, 0.0f },
- { 0.0f, 0.0f, 1.0f + 1.5f * BGC_EPSYLON_FP32, 0.0f }
+ { 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32, 0.0f }
},
{
{ 0.0f, 0.0f, 1.0f, 0.0f },
- { 0.0f, 0.0f, 1.0f - 1.5f * BGC_EPSYLON_FP32, 0.0f }
+ { 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32, 0.0f }
},
{
{ 0.0f, 0.0f, 0.0f, 1.0f },
- { 0.0f, 0.0f, 0.0f, 1.0f + 1.5f * BGC_EPSYLON_FP32 }
+ { 0.0f, 0.0f, 0.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32 }
},
{
{ 0.0f, 0.0f, 0.0f, 1.0f },
- { 0.0f, 0.0f, 0.0f, 1.0f - 1.5f * BGC_EPSYLON_FP32 }
+ { 0.0f, 0.0f, 0.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32 }
},
{
{ 0.707106f, 0.0f, 0.707107f, 0.0f },
@@ -102,7 +102,7 @@ static const _TestVersorPairFP32 _TEST_FP32_DIFFERENT_VERSOR_PAIR_LIST[] = {
}
};
-int test_bgc_versor_are_close_fp32()
+int test_versor_are_close_fp32()
{
print_testing_name("bgc_versor_are_close_fp32");
@@ -135,35 +135,35 @@ static const int _TEST_FP64_CLOSE_VERSOR_PAIR_AMOUNT = 10;
static const _TestVersorPairFP64 _TEST_FP64_CLOSE_VERSOR_PAIR_LIST[] = {
{
{ 1.0, 0.0, 0.0, 0.0 },
- { 1.0 + BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
+ { 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
},
{
{ 1.0, 0.0, 0.0, 0.0 },
- { 1.0 - BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
+ { 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
},
{
{ 0.0, 1.0, 0.0, 0.0 },
- { 0.0, 1.0 + BGC_EPSYLON_FP64, 0.0, 0.0 }
+ { 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }
},
{
{ 0.0, 1.0, 0.0, 0.0 },
- { 0.0, 1.0 - BGC_EPSYLON_FP64, 0.0, 0.0 }
+ { 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0, 0.0 }
},
{
{ 0.0, 0.0, 1.0, 0.0 },
- { 0.0, 0.0, 1.0 + BGC_EPSYLON_FP64, 0.0 }
+ { 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64, 0.0 }
},
{
{ 0.0, 0.0, 1.0, 0.0 },
- { 0.0, 0.0, 1.0 - BGC_EPSYLON_FP64, 0.0 }
+ { 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64, 0.0 }
},
{
{ 0.0, 0.0, 0.0, 1.0 },
- { 0.0, 0.0, 0.0, 1.0 + BGC_EPSYLON_FP64 }
+ { 0.0, 0.0, 0.0, 1.0 + 0.75 * BGC_EPSYLON_FP64 }
},
{
{ 0.0, 0.0, 0.0, 1.0 },
- { 0.0, 0.0, 0.0, 1.0 - BGC_EPSYLON_FP64 }
+ { 0.0, 0.0, 0.0, 1.0 - 0.75 * BGC_EPSYLON_FP64 }
},
{
{ 0.7071067811865475244, 0.0, 0.7071067811865465244, 0.0 },
@@ -180,35 +180,35 @@ static const int _TEST_FP64_DIFFERENT_VERSOR_PAIR_AMOUNT = 10;
static const _TestVersorPairFP64 _TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[] = {
{
{ 1.0, 0.0, 0.0, 0.0 },
- { 1.0 + 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
+ { 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
},
{
{ 1.0, 0.0, 0.0, 0.0 },
- { 1.0 - 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
+ { 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
},
{
{ 0.0, 1.0, 0.0, 0.0 },
- { 0.0, 1.0 + 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }
+ { 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }
},
{
{ 0.0, 1.0, 0.0, 0.0 },
- { 0.0, 1.0 - 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0 }
+ { 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0, 0.0 }
},
{
{ 0.0, 0.0, 1.0, 0.0 },
- { 0.0, 0.0, 1.0 + 1.5 * BGC_EPSYLON_FP64, 0.0 }
+ { 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64, 0.0 }
},
{
{ 0.0, 0.0, 1.0, 0.0 },
- { 0.0, 0.0, 1.0 - 1.5 * BGC_EPSYLON_FP64, 0.0 }
+ { 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64, 0.0 }
},
{
{ 0.0, 0.0, 0.0, 1.0 },
- { 0.0, 0.0, 0.0, 1.0 + 1.5 * BGC_EPSYLON_FP64 }
+ { 0.0, 0.0, 0.0, 1.0 + 1.25 * BGC_EPSYLON_FP64 }
},
{
{ 0.0, 0.0, 0.0, 1.0 },
- { 0.0, 0.0, 0.0, 1.0 - 1.5 * BGC_EPSYLON_FP64 }
+ { 0.0, 0.0, 0.0, 1.0 - 1.25 * BGC_EPSYLON_FP64 }
},
{
{ 0.7071067811866, 0.0, 0.7071067811865, 0.0 },
@@ -220,7 +220,7 @@ static const _TestVersorPairFP64 _TEST_FP64_DIFFERENT_VERSOR_PAIR_LIST[] = {
}
};
-int test_bgc_versor_are_close_fp64()
+int test_versor_are_close_fp64()
{
print_testing_name("bgc_versor_are_close_fp64");
@@ -245,13 +245,13 @@ int test_bgc_versor_are_close_fp64()
return TEST_SUCCES;
}
-int test_bgc_versor_are_close()
+int test_versor_are_close()
{
- if (test_bgc_versor_are_close_fp32() != TEST_SUCCES) {
+ if (test_versor_are_close_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_are_close_fp64() != TEST_SUCCES) {
+ if (test_versor_are_close_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/versor/versor_are_close.h b/basic-geometry-test/tests/versor/versor_are_close.h
index f7ab662..abd5069 100644
--- a/basic-geometry-test/tests/versor/versor_are_close.h
+++ b/basic-geometry-test/tests/versor/versor_are_close.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VERSOR_ARE_CLOSE_H_
#define _TEST_VERSOR_ARE_CLOSE_H_
-int test_bgc_versor_are_close_fp32();
+int test_versor_are_close_fp32();
-int test_bgc_versor_are_close_fp64();
+int test_versor_are_close_fp64();
-int test_bgc_versor_are_close();
+int test_versor_are_close();
#endif
diff --git a/basic-geometry-test/tests/versor/versor_combine.c b/basic-geometry-test/tests/versor/versor_combine.c
index 355649e..8e1c2dd 100644
--- a/basic-geometry-test/tests/versor/versor_combine.c
+++ b/basic-geometry-test/tests/versor/versor_combine.c
@@ -44,7 +44,7 @@ static const _TestVersorTripletFP32 _TEST_FP32_VERSOR_TRIPLET_LIST[] = {
}
};
-int test_bgc_versor_combine_fp32()
+int test_versor_combine_fp32()
{
BgcVersorFP32 versor;
@@ -96,7 +96,7 @@ static const _TestVersorTripletFP64 _TEST_FP64_VERSOR_TRIPLET_LIST[] = {
}
};
-int test_bgc_versor_combine_fp64()
+int test_versor_combine_fp64()
{
BgcVersorFP64 versor;
@@ -116,13 +116,13 @@ int test_bgc_versor_combine_fp64()
return TEST_SUCCES;
}
-int test_bgc_versor_combine()
+int test_versor_combine()
{
- if (test_bgc_versor_combine_fp32() != TEST_SUCCES) {
+ if (test_versor_combine_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_combine_fp64() != TEST_SUCCES) {
+ if (test_versor_combine_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/versor/versor_combine.h b/basic-geometry-test/tests/versor/versor_combine.h
index 154dfb6..41113ee 100644
--- a/basic-geometry-test/tests/versor/versor_combine.h
+++ b/basic-geometry-test/tests/versor/versor_combine.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VERSOR_COMBINE_H_
#define _TEST_VERSOR_COMBINE_H_
-int test_bgc_versor_combine_fp32();
+int test_versor_combine_fp32();
-int test_bgc_versor_combine_fp64();
+int test_versor_combine_fp64();
-int test_bgc_versor_combine();
+int test_versor_combine();
#endif
diff --git a/basic-geometry-test/tests/versor/versor_copy.c b/basic-geometry-test/tests/versor/versor_copy.c
index 94a304e..7205f38 100644
--- a/basic-geometry-test/tests/versor/versor_copy.c
+++ b/basic-geometry-test/tests/versor/versor_copy.c
@@ -18,7 +18,7 @@ static const BgcVersorFP32 _TEST_FP32_VERSOR_LIST[] = {
{ 0.7071067812f, 0.0f, 0.0f, -0.7071067812f }
};
-int test_bgc_versor_copy_fp32()
+int test_versor_copy_fp32()
{
BgcVersorFP32 versor;
@@ -56,7 +56,7 @@ static const BgcVersorFP64 _TEST_FP64_VERSOR_LIST[] = {
{ 0.7071067811865475, 0.0, 0.0, -0.7071067811865475 }
};
-int test_bgc_versor_copy_fp64()
+int test_versor_copy_fp64()
{
BgcVersorFP64 versor;
@@ -80,13 +80,13 @@ int test_bgc_versor_copy_fp64()
return TEST_SUCCES;
}
-int test_bgc_versor_copy()
+int test_versor_copy()
{
- if (test_bgc_versor_copy_fp32() != TEST_SUCCES) {
+ if (test_versor_copy_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_copy_fp64() != TEST_SUCCES) {
+ if (test_versor_copy_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/versor/versor_copy.h b/basic-geometry-test/tests/versor/versor_copy.h
index 80fe404..68b0328 100644
--- a/basic-geometry-test/tests/versor/versor_copy.h
+++ b/basic-geometry-test/tests/versor/versor_copy.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VERSOR_COPY_H_
#define _TEST_VERSOR_COPY_H_
-int test_bgc_versor_copy_fp32();
+int test_versor_copy_fp32();
-int test_bgc_versor_copy_fp64();
+int test_versor_copy_fp64();
-int test_bgc_versor_copy();
+int test_versor_copy();
#endif
diff --git a/basic-geometry-test/tests/versor/versor_is_identity.c b/basic-geometry-test/tests/versor/versor_is_identity.c
new file mode 100644
index 0000000..a3cd901
--- /dev/null
+++ b/basic-geometry-test/tests/versor/versor_is_identity.c
@@ -0,0 +1,116 @@
+#include "./versor_is_identity.h"
+
+#include "./../../helpers.h"
+
+// ==================== FP32 ==================== //
+
+static const int _TEST_FP32_IDENTIYTY_VERSOR_AMOUNT = 9;
+static const int _TEST_FP32_NON_IDENTIYTY_VERSOR_AMOUNT = 5;
+
+static const BgcVersorFP32 _TEST_FP32_IDENTIYTY_VERSOR_LIST[] = {
+ { 1.0f, 0.0f, 0.0f, 0.0f },
+ { 1.0f + BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
+ { 1.0f - BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f },
+ { 1.0f, BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { 1.0f, -BGC_EPSYLON_FP32, 0.0f, 0.0f },
+ { 1.0f, 0.0f, BGC_EPSYLON_FP32, 0.0f },
+ { 1.0f, 0.0f, -BGC_EPSYLON_FP32, 0.0f },
+ { 1.0f, 0.0f, 0.0f, BGC_EPSYLON_FP32 },
+ { 1.0f, 0.0f, 0.0f, -BGC_EPSYLON_FP32 }
+};
+
+static const BgcVersorFP32 _TEST_FP32_NON_IDENTIYTY_VERSOR_LIST[] = {
+ { 0.0f, 1.0f, 0.0f, 0.0f },
+ { 0.0f, 0.0f, 1.0f, 0.0f },
+ { 0.0f, 0.0f, 0.0f, 1.0f },
+ { 0.5f, 0.5f, 0.5f, 0.5f },
+ { 1.0f - 1.5f * BGC_EPSYLON_FP32, 0.0f, 0.0f, 0.0f }
+};
+
+int test_versor_is_identity_fp32()
+{
+ print_testing_name("bgc_versor_is_identity_fp32");
+
+ // Testing zero values:
+ for (int i = 0; i < _TEST_FP32_IDENTIYTY_VERSOR_AMOUNT; i++) {
+ if (!bgc_versor_is_identity_fp32(&_TEST_FP32_IDENTIYTY_VERSOR_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ // Testing non-zero values:
+ 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])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+// ==================== FP64 ==================== //
+
+static const int _TEST_FP64_IDENTIYTY_VERSOR_AMOUNT = 9;
+static const int _TEST_FP64_NON_IDENTIYTY_VERSOR_AMOUNT = 5;
+
+static const BgcVersorFP64 _TEST_FP64_IDENTIYTY_VERSOR_LIST[] = {
+ { 1.0, 0.0, 0.0, 0.0 },
+ { 1.0 + BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
+ { 1.0 - BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 },
+ { 1.0, -BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { 1.0, BGC_EPSYLON_FP64, 0.0, 0.0 },
+ { 1.0, 0.0, BGC_EPSYLON_FP64, 0.0 },
+ { 1.0, 0.0, -BGC_EPSYLON_FP64, 0.0 },
+ { 1.0, 0.0, 0.0, BGC_EPSYLON_FP64 },
+ { 1.0, 0.0, 0.0, -BGC_EPSYLON_FP64 }
+};
+
+static const BgcVersorFP64 _TEST_FP64_NON_IDENTIYTY_VERSOR_LIST[] = {
+ { 0.0, 1.0, 0.0, 0.0 },
+ { 0.0, 0.0, 1.0, 0.0 },
+ { 0.0, 0.0, 0.0, 1.0 },
+ { 0.5, 0.5, 0.5, 0.5 },
+ { 1.0 - 1.5 * BGC_EPSYLON_FP64, 0.0, 0.0, 0.0 }
+};
+
+int test_versor_is_identity_fp64()
+{
+ print_testing_name("bgc_versor_is_identity_fp64");
+
+ // Testing zero values:
+ for (int i = 0; i < _TEST_FP64_IDENTIYTY_VERSOR_AMOUNT; i++) {
+ if (!bgc_versor_is_identity_fp64(&_TEST_FP64_IDENTIYTY_VERSOR_LIST[i])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ // Testing non-zero values:
+ 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])) {
+ print_testing_failed();
+ return TEST_FAILED;
+ }
+ }
+
+ print_testing_success();
+
+ return TEST_SUCCES;
+}
+
+int test_versor_is_identity()
+{
+ if (test_versor_is_identity_fp32() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ if (test_versor_is_identity_fp64() != TEST_SUCCES) {
+ return TEST_FAILED;
+ }
+
+ return TEST_SUCCES;
+}
diff --git a/basic-geometry-test/tests/versor/versor_is_identity.h b/basic-geometry-test/tests/versor/versor_is_identity.h
new file mode 100644
index 0000000..fa9f7da
--- /dev/null
+++ b/basic-geometry-test/tests/versor/versor_is_identity.h
@@ -0,0 +1,10 @@
+#ifndef _TEST_VERSOR_IS_IDENTITY_H_
+#define _TEST_VERSOR_IS_IDENTITY_H_
+
+int test_versor_is_identity_fp32();
+
+int test_versor_is_identity_fp64();
+
+int test_versor_is_identity();
+
+#endif
diff --git a/basic-geometry-test/tests/versor/versor_reset.c b/basic-geometry-test/tests/versor/versor_reset.c
index 7917c54..da68efe 100644
--- a/basic-geometry-test/tests/versor/versor_reset.c
+++ b/basic-geometry-test/tests/versor/versor_reset.c
@@ -2,7 +2,7 @@
#include "./../../helpers.h"
-int test_bgc_versor_reset_fp32()
+int test_versor_reset_fp32()
{
BgcVersorFP32 versor;
@@ -20,7 +20,7 @@ int test_bgc_versor_reset_fp32()
return TEST_SUCCES;
}
-int test_bgc_versor_reset_fp64()
+int test_versor_reset_fp64()
{
BgcVersorFP64 versor;
@@ -38,13 +38,13 @@ int test_bgc_versor_reset_fp64()
return TEST_SUCCES;
}
-int test_bgc_versor_reset()
+int test_versor_reset()
{
- if (test_bgc_versor_reset_fp32() != TEST_SUCCES) {
+ if (test_versor_reset_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_reset_fp64() != TEST_SUCCES) {
+ if (test_versor_reset_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/versor/versor_reset.h b/basic-geometry-test/tests/versor/versor_reset.h
index 65134e5..4b004d4 100644
--- a/basic-geometry-test/tests/versor/versor_reset.h
+++ b/basic-geometry-test/tests/versor/versor_reset.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VERSOR_RESET_H_
#define _TEST_VERSOR_RESET_H_
-int test_bgc_versor_reset_fp32();
+int test_versor_reset_fp32();
-int test_bgc_versor_reset_fp64();
+int test_versor_reset_fp64();
-int test_bgc_versor_reset();
+int test_versor_reset();
#endif
diff --git a/basic-geometry-test/tests/versor/versor_set_values.c b/basic-geometry-test/tests/versor/versor_set_values.c
index b5db84e..ed3cf11 100644
--- a/basic-geometry-test/tests/versor/versor_set_values.c
+++ b/basic-geometry-test/tests/versor/versor_set_values.c
@@ -22,7 +22,7 @@ static const _TestVersorComponentsFP32 _TEST_FP32_VERSOR_DATA_LIST[] = {
{ 1.0f, 0.0f, 1.0f, 0.0f }
};
-int test_bgc_versor_set_values_fp32()
+int test_versor_set_values_fp32()
{
float versor_module, ratio;
BgcVersorFP32 versor;
@@ -86,7 +86,7 @@ static const _TestVersorComponentsFP64 _TEST_FP64_VERSOR_DATA_LIST[] = {
{ 1.0, 0.0, 1.0, 0.0 }
};
-int test_bgc_versor_set_values_fp64()
+int test_versor_set_values_fp64()
{
double versor_module, ratio;
BgcVersorFP64 versor;
@@ -140,13 +140,13 @@ int test_bgc_versor_set_values_fp64()
return TEST_SUCCES;
}
-int test_bgc_versor_set_values()
+int test_versor_set_values()
{
- if (test_bgc_versor_set_values_fp32() != TEST_SUCCES) {
+ if (test_versor_set_values_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_set_values_fp64() != TEST_SUCCES) {
+ if (test_versor_set_values_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/versor/versor_set_values.h b/basic-geometry-test/tests/versor/versor_set_values.h
index e14dbda..0cace28 100644
--- a/basic-geometry-test/tests/versor/versor_set_values.h
+++ b/basic-geometry-test/tests/versor/versor_set_values.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VERSOR_SET_VALUES_H_
#define _TEST_VERSOR_SET_VALUES_H_
-int test_bgc_versor_set_values_fp32();
+int test_versor_set_values_fp32();
-int test_bgc_versor_set_values_fp64();
+int test_versor_set_values_fp64();
-int test_bgc_versor_set_values();
+int test_versor_set_values();
#endif
diff --git a/basic-geometry-test/tests/versor/versor_swap.c b/basic-geometry-test/tests/versor/versor_swap.c
index b133886..2b85697 100644
--- a/basic-geometry-test/tests/versor/versor_swap.c
+++ b/basic-geometry-test/tests/versor/versor_swap.c
@@ -28,7 +28,7 @@ static const _TestVersorDataFP32 _TEST_FP32_VERSOR_LIST2[] = {
{ 4.0f, 3.0f, 2.0f, 1.0f }
};
-int test_bgc_versor_swap_fp32()
+int test_versor_swap_fp32()
{
BgcVersorFP32 versor1a, versor2a, versor1b, versor2b;
@@ -70,7 +70,7 @@ int test_bgc_versor_swap_fp32()
// ==================== FP64 ==================== //
-int test_bgc_versor_swap_fp64()
+int test_versor_swap_fp64()
{
BgcVersorFP64 versor1a, versor2a, versor1b, versor2b;
@@ -110,13 +110,13 @@ int test_bgc_versor_swap_fp64()
return TEST_SUCCES;
}
-int test_bgc_versor_swap()
+int test_versor_swap()
{
- if (test_bgc_versor_swap_fp32() != TEST_SUCCES) {
+ if (test_versor_swap_fp32() != TEST_SUCCES) {
return TEST_FAILED;
}
- if (test_bgc_versor_swap_fp64() != TEST_SUCCES) {
+ if (test_versor_swap_fp64() != TEST_SUCCES) {
return TEST_FAILED;
}
diff --git a/basic-geometry-test/tests/versor/versor_swap.h b/basic-geometry-test/tests/versor/versor_swap.h
index b6551c5..2bf1e46 100644
--- a/basic-geometry-test/tests/versor/versor_swap.h
+++ b/basic-geometry-test/tests/versor/versor_swap.h
@@ -1,10 +1,10 @@
#ifndef _TEST_VERSOR_SWAP_H_
#define _TEST_VERSOR_SWAP_H_
-int test_bgc_versor_swap_fp32();
+int test_versor_swap_fp32();
-int test_bgc_versor_swap_fp64();
+int test_versor_swap_fp64();
-int test_bgc_versor_swap();
+int test_versor_swap();
#endif
diff --git a/basic-geometry/quaternion.c b/basic-geometry/quaternion.c
index 2bbe84a..847b789 100644
--- a/basic-geometry/quaternion.c
+++ b/basic-geometry/quaternion.c
@@ -33,6 +33,12 @@ extern inline double bgc_quaternion_get_square_modulus_fp64(const BgcQuaternionF
extern inline float bgc_quaternion_get_modulus_fp32(const BgcQuaternionFP32* quaternion);
extern inline double bgc_quaternion_get_modulus_fp64(const BgcQuaternionFP64* quaternion);
+extern inline int bgc_quaternion_is_zero_fp32(const BgcQuaternionFP32* quaternion);
+extern inline int bgc_quaternion_is_zero_fp64(const BgcQuaternionFP64* quaternion);
+
+extern inline int bgc_quaternion_is_unit_fp32(const BgcQuaternionFP32* quaternion);
+extern inline int bgc_quaternion_is_unit_fp64(const BgcQuaternionFP64* quaternion);
+
extern inline int bgc_quaternion_normalize_fp32(BgcQuaternionFP32* quaternion);
extern inline int bgc_quaternion_normalize_fp64(BgcQuaternionFP64* quaternion);
diff --git a/basic-geometry/quaternion.h b/basic-geometry/quaternion.h
index bfbb0ac..ae774bf 100644
--- a/basic-geometry/quaternion.h
+++ b/basic-geometry/quaternion.h
@@ -219,6 +219,30 @@ inline double bgc_quaternion_get_modulus_fp64(const BgcQuaternionFP64* quaternio
return sqrt(bgc_quaternion_get_square_modulus_fp64(quaternion));
}
+// ================== Is Zero =================== //
+
+inline int bgc_quaternion_is_zero_fp32(const BgcQuaternionFP32* quaternion)
+{
+ return bgc_quaternion_get_square_modulus_fp32(quaternion) <= BGC_SQUARE_EPSYLON_FP32;
+}
+
+inline int bgc_quaternion_is_zero_fp64(const BgcQuaternionFP64* quaternion)
+{
+ return bgc_quaternion_get_square_modulus_fp64(quaternion) <= BGC_SQUARE_EPSYLON_FP64;
+}
+
+// ================== Is Unit =================== //
+
+inline int bgc_quaternion_is_unit_fp32(const BgcQuaternionFP32* quaternion)
+{
+ return bgc_is_sqare_value_unit_fp32(bgc_quaternion_get_square_modulus_fp32(quaternion));
+}
+
+inline int bgc_quaternion_is_unit_fp64(const BgcQuaternionFP64* quaternion)
+{
+ return bgc_is_sqare_value_unit_fp64(bgc_quaternion_get_square_modulus_fp64(quaternion));
+}
+
// =============== Normalization ================ //
inline int bgc_quaternion_normalize_fp32(BgcQuaternionFP32* quaternion)
diff --git a/basic-geometry/versor.c b/basic-geometry/versor.c
index 96f6482..8be8990 100644
--- a/basic-geometry/versor.c
+++ b/basic-geometry/versor.c
@@ -25,8 +25,8 @@ extern inline void bgc_versor_set_turn_fp64(const BgcVector3FP32* axis, const do
extern inline void bgc_versor_set_rotation_fp32(const BgcRotation3FP32* rotation, BgcVersorFP32* result);
extern inline void bgc_versor_set_rotation_fp64(const BgcRotation3FP64* rotation, BgcVersorFP64* result);
-extern inline int bgc_versor_is_idle_fp32(const BgcVersorFP32* versor);
-extern inline int bgc_versor_is_idle_fp64(const BgcVersorFP64* versor);
+extern inline int bgc_versor_is_identity_fp32(const BgcVersorFP32* versor);
+extern inline int bgc_versor_is_identity_fp64(const BgcVersorFP64* versor);
extern inline void bgc_versor_convert_fp64_to_fp32(const BgcVersorFP64* versor, BgcVersorFP32* result);
extern inline void bgc_versor_convert_fp32_to_fp64(const BgcVersorFP32* versor, BgcVersorFP64* result);
diff --git a/basic-geometry/versor.h b/basic-geometry/versor.h
index f0404fc..747feb9 100644
--- a/basic-geometry/versor.h
+++ b/basic-geometry/versor.h
@@ -194,12 +194,12 @@ inline void bgc_versor_set_rotation_fp64(const BgcRotation3FP64* rotation, BgcVe
// ================= Comparison ================= //
-inline int bgc_versor_is_idle_fp32(const BgcVersorFP32* versor)
+inline int bgc_versor_is_identity_fp32(const BgcVersorFP32* versor)
{
return 1.0f - BGC_EPSYLON_FP32 <= versor->s0 || versor->s0 <= -(1.0 - BGC_EPSYLON_FP32);
}
-inline int bgc_versor_is_idle_fp64(const BgcVersorFP64* versor)
+inline int bgc_versor_is_identity_fp64(const BgcVersorFP64* versor)
{
return 1.0 - BGC_EPSYLON_FP64 <= versor->s0 || versor->s0 <= -(1.0 - BGC_EPSYLON_FP64);
}