Добавлены функции модуля для версоров и кватернионо / Functions of modulus have been added for versors and quaternions

This commit is contained in:
Andrey Pokidov 2024-11-25 19:47:45 +07:00
parent bef7ab98f4
commit 03e390c1d0
12 changed files with 246 additions and 211 deletions

View file

@ -18,20 +18,20 @@ const BgFP32Vector2 TEST_BG_FP32_VECTOR2_COMMON_2[] = {
{ 1.5f, -23.35f }
};
// =============== Square module ================ //
// =============== Square modulus =============== //
const float BG_FP32_VECTOR2_SQUARE_MODULE_1[] = { 25.0f, 25.0f, 500000000.0f, 100.01f, 15266.150221f };
const float BG_FP32_VECTOR2_SQUARE_MODULUS_1[] = { 25.0f, 25.0f, 500000000.0f, 100.01f, 15266.150221f };
int test_bg_fp32_vector2_square_module()
int test_bg_fp32_vector2_square_modulus()
{
print_test_name("BgFP32Vector2 square module");
print_test_name("BgFP32Vector2 square modulus");
float square_module;
float square_modulus;
for (int i = 0; i < TEST_BG_FP32_VECTOR2_AMOUNT_1; i++) {
square_module = bg_fp32_vector2_get_square_module(&TEST_BG_FP32_VECTOR2_COMMON_1[i]);
square_modulus = bg_fp32_vector2_get_square_modulus(&TEST_BG_FP32_VECTOR2_COMMON_1[i]);
if (!test_bg_fp32_are_equal(square_module, BG_FP32_VECTOR2_SQUARE_MODULE_1[i], TEST_BG_FP32_TWO_EPSYLON)) {
if (!test_bg_fp32_are_equal(square_modulus, BG_FP32_VECTOR2_SQUARE_MODULUS_1[i], TEST_BG_FP32_TWO_EPSYLON)) {
print_test_failed();
return TEST_RESULT_FAILED;
}
@ -43,18 +43,18 @@ int test_bg_fp32_vector2_square_module()
// =================== Module =================== //
const float BG_FP32_VECTOR2_MODULE_1[] = { 5.0f, 5.0f, 22360.68f, 10.0005f, 123.55626338f };
const float BG_FP32_VECTOR2_MODULUS_1[] = { 5.0f, 5.0f, 22360.68f, 10.0005f, 123.55626338f };
int test_bg_fp32_vector2_module()
int test_bg_fp32_vector2_modulus()
{
print_test_name("BgFP32Vector2 module");
print_test_name("BgFP32Vector2 modulus");
float square_module;
float square_modulus;
for (int i = 0; i < TEST_BG_FP32_VECTOR2_AMOUNT_1; i++) {
square_module = bg_fp32_vector2_get_module(&TEST_BG_FP32_VECTOR2_COMMON_1[i]);
square_modulus = bg_fp32_vector2_get_modulus(&TEST_BG_FP32_VECTOR2_COMMON_1[i]);
if (!test_bg_fp32_are_equal(square_module, BG_FP32_VECTOR2_MODULE_1[i], TEST_BG_FP32_EPSYLON)) {
if (!test_bg_fp32_are_equal(square_modulus, BG_FP32_VECTOR2_MODULUS_1[i], TEST_BG_FP32_EPSYLON)) {
print_test_failed();
return TEST_RESULT_FAILED;
}
@ -130,11 +130,11 @@ int test_bg_fp32_vector2()
{
print_test_section("BgFP32Vector2");
if (test_bg_fp32_vector2_square_module() != TEST_RESULT_SUCCES) {
if (test_bg_fp32_vector2_square_modulus() != TEST_RESULT_SUCCES) {
return TEST_RESULT_FAILED;
}
if (test_bg_fp32_vector2_module() != TEST_RESULT_SUCCES) {
if (test_bg_fp32_vector2_modulus() != TEST_RESULT_SUCCES) {
return TEST_RESULT_FAILED;
}

View file

@ -5,9 +5,9 @@
int test_bg_fp32_vector2();
int test_bg_fp32_vector2_square_module();
int test_bg_fp32_vector2_square_modulus();
int test_bg_fp32_vector2_module();
int test_bg_fp32_vector2_modulus();
int test_bg_fp32_vector2_add();