реорганизация функций проекта, уменьшение дублирующегося кода

This commit is contained in:
Andrey Pokidov 2025-02-04 13:20:46 +07:00
parent 6c0ae92ed4
commit 07623b2aa6
10 changed files with 84 additions and 67 deletions

View file

@ -198,16 +198,12 @@ inline int bgc_vector3_is_zero_fp64(const BgcVector3FP64* vector)
inline int bgc_vector3_is_unit_fp32(const BgcVector3FP32* vector)
{
const float square_modulus = bgc_vector3_get_square_modulus_fp32(vector);
return 1.0f - BGC_TWO_EPSYLON_FP32 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP32;
return bgc_is_sqare_value_unit_fp32(bgc_vector3_get_square_modulus_fp32(vector));
}
inline int bgc_vector3_is_unit_fp64(const BgcVector3FP64* vector)
{
const double square_modulus = bgc_vector3_get_square_modulus_fp64(vector);
return 1.0f - BGC_TWO_EPSYLON_FP64 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP64;
return bgc_is_sqare_value_unit_fp64(bgc_vector3_get_square_modulus_fp64(vector));
}
// ==================== Add ===================== //
@ -398,7 +394,7 @@ inline int bgc_vector3_normalize_fp32(BgcVector3FP32* vector)
{
const float square_modulus = bgc_vector3_get_square_modulus_fp32(vector);
if (1.0f - BGC_TWO_EPSYLON_FP32 <= square_modulus && square_modulus <= 1.0f + BGC_TWO_EPSYLON_FP32) {
if (bgc_is_sqare_value_unit_fp32(square_modulus)) {
return 1;
}
@ -415,7 +411,7 @@ inline int bgc_vector3_normalize_fp64(BgcVector3FP64* vector)
{
const double square_modulus = bgc_vector3_get_square_modulus_fp64(vector);
if (1.0 - BGC_TWO_EPSYLON_FP64 <= square_modulus && square_modulus <= 1.0 + BGC_TWO_EPSYLON_FP64) {
if (bgc_is_sqare_value_unit_fp64(square_modulus)) {
return 1;
}