реорганизация функций проекта, уменьшение дублирующегося кода
This commit is contained in:
parent
6c0ae92ed4
commit
07623b2aa6
10 changed files with 84 additions and 67 deletions
|
@ -225,7 +225,7 @@ inline int bgc_quaternion_normalize_fp32(BgcQuaternionFP32* quaternion)
|
|||
{
|
||||
const float square_modulus = bgc_quaternion_get_square_modulus_fp32(quaternion);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ inline int bgc_quaternion_normalize_fp64(BgcQuaternionFP64* quaternion)
|
|||
{
|
||||
const double square_modulus = bgc_quaternion_get_square_modulus_fp64(quaternion);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ inline void bgc_quaternion_get_rotation_matrix_fp32(const BgcQuaternionFP32* qua
|
|||
|
||||
const float square_modulus = (s0s0 + x1x1) + (x2x2 + x3x3);
|
||||
|
||||
if (-BGC_EPSYLON_FP32 <= square_modulus && square_modulus <= BGC_EPSYLON_FP32)
|
||||
if (bgc_is_zero_fp32(square_modulus))
|
||||
{
|
||||
bgc_matrix3x3_set_to_identity_fp32(matrix);
|
||||
return;
|
||||
|
@ -316,7 +316,7 @@ inline void bgc_quaternion_get_rotation_matrix_fp64(const BgcQuaternionFP64* qua
|
|||
|
||||
const double square_modulus = (s0s0 + x1x1) + (x2x2 + x3x3);
|
||||
|
||||
if (-BGC_EPSYLON_FP64 <= square_modulus && square_modulus <= BGC_EPSYLON_FP64)
|
||||
if (bgc_is_zero_fp64(square_modulus))
|
||||
{
|
||||
bgc_matrix3x3_set_to_identity_fp64(matrix);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue