Добавлена комбинация трёх версоров одной операцией

This commit is contained in:
Andrey Pokidov 2024-12-25 13:46:31 +07:00
parent fcbec62024
commit d2a25823a5

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

@ -440,6 +440,74 @@ static inline void bg_fp64_versor_combine(const BgFP64Versor* second, const BgFP
twin->x3 *= multiplier; twin->x3 *= multiplier;
} }
// ============ Combination of three ============ //
static inline void bg_fp32_versor_combine3(const BgFP32Versor* third, const BgFP32Versor* second, const BgFP32Versor* first, BgFP32Versor* result)
{
const float s0a = (second->s0 * first->s0 - second->x1 * first->x1) - (second->x2 * first->x2 + second->x3 * first->x3);
const float x1a = (second->x1 * first->s0 + second->s0 * first->x1) - (second->x3 * first->x2 - second->x2 * first->x3);
const float x2a = (second->x2 * first->s0 + second->s0 * first->x2) - (second->x1 * first->x3 - second->x3 * first->x1);
const float x3a = (second->x3 * first->s0 + second->s0 * first->x3) - (second->x2 * first->x1 - second->x1 * first->x2);
const float s0b = (third->s0 * s0a - third->x1 * x1a) - (third->x2 * x2a + third->x3 * x3a);
const float x1b = (third->x1 * s0a + third->s0 * x1a) - (third->x3 * x2a - third->x2 * x3a);
const float x2b = (third->x2 * s0a + third->s0 * x2a) - (third->x1 * x3a - third->x3 * x1a);
const float x3b = (third->x3 * s0a + third->s0 * x3a) - (third->x2 * x1a - third->x1 * x2a);
const float square_modulus = (s0b * s0b + x1b * x1b) + (x2b * x2b + x3b * x3b);
__BgFP32DarkTwinVersor* twin = (__BgFP32DarkTwinVersor*)result;
twin->s0 = s0b;
twin->x1 = x1b;
twin->x2 = x2b;
twin->x3 = x3b;
if (1.0f - BG_FP32_TWO_EPSYLON <= square_modulus && square_modulus <= 1.0f + BG_FP32_TWO_EPSYLON) {