Добавление сферической интерполяции, переход от применения acos к применению atan2, исправление ошибок

This commit is contained in:
Andrey Pokidov 2025-03-17 09:56:56 +07:00
parent f06b35ae34
commit 9d7011e81e
17 changed files with 558 additions and 134 deletions

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

@ -81,7 +81,6 @@ void _bgc_versor_normalize_fp32(const float square_modulus, _BgcDarkTwinVersorFP
twin->x1 *= multiplier;
twin->x2 *= multiplier;
twin->x3 *= multiplier;
}
void _bgc_versor_normalize_fp64(const double square_modulus, _BgcDarkTwinVersorFP64* twin)
@ -152,54 +151,22 @@ void bgc_versor_set_turn_fp64(const double x1, const double x2, const double x3,
bgc_versor_set_values_fp64(cos(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier, result);
}
// ================ Get Rotation ================ //
void bgc_versor_get_rotation_fp32(const BgcVersorFP32* versor, BgcRotation3FP32* result)
{
if (versor->s0 <= -(1.0f - BGC_EPSYLON_FP32) || 1.0f - BGC_EPSYLON_FP32 <= versor->s0) {
bgc_rotation3_reset_fp32(result);
return;
}
const float multiplier = sqrtf(1.0f / (versor->x1 * versor->x1 + versor->x2 * versor->x2 + versor->x3 * versor->x3));
result->radians = 2.0f * acosf(versor->s0);
result->axis.x1 = versor->x1 * multiplier;
result->axis.x2 = versor->x2 * multiplier;
result->axis.x3 = versor->x3 * multiplier;
}
void bgc_versor_get_rotation_fp64(const BgcVersorFP64* versor, BgcRotation3FP64* result)
{