#include "posture3.h" extern inline void bgc_fp32_posture3_reset(BGC_FP32_Posture3* posture); extern inline void bgc_fp64_posture3_reset(BGC_FP64_Posture3* posture); void _bgc_fp32_posture3_normalize(BGC_FP32_Posture3* posture) { const float square_magnitude = bgc_fp32_quaternion_get_square_magnitude(&posture->_dual_versor.real_part); if (square_magnitude <= BGC_FP32_SQUARE_EPSILON || isnan(square_magnitude)) { bgc_fp32_posture3_reset(posture); return; } const float multiplier = sqrtf(1.0f / square_magnitude); bgc_fp32_quaternion_multiply_by_real(&posture->_dual_versor.real_part, &posture->_dual_versor.real_part, multiplier); bgc_fp32_quaternion_multiply_by_real(&posture->_dual_versor.dual_part, &posture->_dual_versor.dual_part, multiplier); }