Задача 0000001: отказ от использования корректоров в версорах / Task 0000001: declining of usage of correctors in versors

This commit is contained in:
Andrey Pokidov 2024-11-19 14:21:01 +07:00
parent 07c1330858
commit 791557fb94
9 changed files with 421 additions and 364 deletions

View file

@ -17,17 +17,8 @@ void sp_quaternion_make_matrix(const SPQuaternion* quaternion, SPMatrix3x3* matr
return;
}
float corrector1;
float corrector2;
if (1.0f - SP_TWO_EPSYLON <= square_module && square_module <= 1.0f + SP_TWO_EPSYLON) {
corrector1 = 2.0f - square_module;
corrector2 = 2.0f * corrector1;
}
else {
corrector1 = 1.0f / square_module;
corrector2 = 2.0f / square_module;
}
const float corrector1 = 1.0f / square_module;
const float corrector2 = 2.0f * corrector1;
const float s0x1 = quaternion->s0 * quaternion->x1;
const float s0x2 = quaternion->s0 * quaternion->x2;
@ -64,17 +55,8 @@ void dp_quaternion_make_matrix(const DPQuaternion* quaternion, DPMatrix3x3* matr
return;
}
double corrector1;
double corrector2;
if (1.0 - DP_TWO_EPSYLON <= square_module && square_module <= 1.0 + DP_TWO_EPSYLON) {
corrector1 = 2.0 - square_module;
corrector2 = 2.0 * corrector1;
}
else {
corrector1 = 1.0 / square_module;
corrector2 = 2.0 / square_module;
}
const double corrector1 = 1.0f / square_module;
const double corrector2 = 2.0f * corrector1;
const double s0x1 = quaternion->s0 * quaternion->x1;
const double s0x2 = quaternion->s0 * quaternion->x2;
@ -113,17 +95,8 @@ void sp_quaternion_make_reverse_matrix(const SPQuaternion* quaternion, SPMatrix3
return;
}
float corrector1;
float corrector2;
if (1.0f - SP_TWO_EPSYLON <= square_module && square_module <= 1.0f + SP_TWO_EPSYLON) {
corrector1 = 2.0f - square_module;
corrector2 = 2.0f * corrector1;
}
else {
corrector1 = 1.0f / square_module;
corrector2 = 2.0f / square_module;
}
const float corrector1 = 1.0f / square_module;
const float corrector2 = 2.0f * corrector1;
const float s0x1 = quaternion->s0 * quaternion->x1;
const float s0x2 = quaternion->s0 * quaternion->x2;
@ -160,17 +133,8 @@ void dp_quaternion_make_reverse_matrix(const DPQuaternion* quaternion, DPMatrix3
return;
}
double corrector1;
double corrector2;
if (1.0 - DP_TWO_EPSYLON <= square_module && square_module <= 1.0 + DP_TWO_EPSYLON) {
corrector1 = 2.0 - square_module;
corrector2 = 2.0 * corrector1;
}
else {
corrector1 = 1.0 / square_module;
corrector2 = 2.0 / square_module;
}
const double corrector1 = 1.0f / square_module;
const double corrector2 = 2.0f * corrector1;
const double s0x1 = quaternion->s0 * quaternion->x1;
const double s0x2 = quaternion->s0 * quaternion->x2;