Добавление проверки при делении, стандартизация возвращаемого значения (BGC_SUCCESS, BGC_FAILURE)
This commit is contained in:
parent
a4b9f8b2b9
commit
e9558ff977
27 changed files with 589 additions and 370 deletions
|
|
@ -85,7 +85,7 @@ void _bgc_fp32_turn3_normalize(BGC_FP32_Turn3* turn, const float square_modulus)
|
|||
return;
|
||||
}
|
||||
|
||||
bgc_fp32_quaternion_multiply_by_number(&turn->_versor, &turn->_versor, sqrtf(1.0f / square_modulus));
|
||||
bgc_fp32_quaternion_multiply_by_real(&turn->_versor, &turn->_versor, sqrtf(1.0f / square_modulus));
|
||||
}
|
||||
|
||||
void _bgc_fp64_turn3_normalize(BGC_FP64_Turn3* turn, const double square_modulus)
|
||||
|
|
@ -95,7 +95,7 @@ void _bgc_fp64_turn3_normalize(BGC_FP64_Turn3* turn, const double square_modulus
|
|||
return;
|
||||
}
|
||||
|
||||
bgc_fp64_quaternion_multiply_by_number(&turn->_versor, &turn->_versor, sqrt(1.0 / square_modulus));
|
||||
bgc_fp64_quaternion_multiply_by_real(&turn->_versor, &turn->_versor, sqrt(1.0 / square_modulus));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ void bgc_fp64_turn3_set_rotation(BGC_FP64_Turn3* turn, const double x1, const do
|
|||
int bgc_fp32_turn3_find_direction_difference(BGC_FP32_Turn3* turn, const BGC_FP32_Vector3* first, const BGC_FP32_Vector3* second)
|
||||
{
|
||||
const float first_square_modulus = bgc_fp32_vector3_get_square_modulus(first);
|
||||
|
||||
|
||||
bgc_fp32_turn3_reset(turn);
|
||||
|
||||
if (first_square_modulus <= BGC_FP32_SQUARE_EPSILON) {
|
||||
|
|
@ -308,7 +308,7 @@ static inline int _bgc_fp32_turn3_get_orthogonal_pair(BGC_FP32_Vector3* unit_mai
|
|||
return _BGC_ERROR_TURN3_EMPTY_BRANCH;
|
||||
}
|
||||
|
||||
bgc_fp32_vector3_multiply(unit_main, main, sqrtf(1.0f / main_square_modulus));
|
||||
bgc_fp32_vector3_multiply_by_real(unit_main, main, sqrtf(1.0f / main_square_modulus));
|
||||
|
||||
bgc_fp32_vector3_add_scaled(unit_branch, branch, unit_main, -bgc_fp32_vector3_get_dot_product(branch, unit_main));
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ static inline int _bgc_fp32_turn3_get_orthogonal_pair(BGC_FP32_Vector3* unit_mai
|
|||
return _BGC_ERROR_TURN3_PAIR_PARALLEL;
|
||||
}
|
||||
|
||||
bgc_fp32_vector3_multiply(unit_branch, unit_branch, sqrtf(1.0f / orthogonal_square_modulus));
|
||||
bgc_fp32_vector3_multiply_by_real(unit_branch, unit_branch, sqrtf(1.0f / orthogonal_square_modulus));
|
||||
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
|
@ -337,7 +337,7 @@ static inline int _bgc_fp64_turn3_get_orthogonal_pair(BGC_FP64_Vector3* unit_mai
|
|||
return _BGC_ERROR_TURN3_EMPTY_BRANCH;
|
||||
}
|
||||
|
||||
bgc_fp64_vector3_multiply(unit_main, main, sqrt(1.0 / main_square_modulus));
|
||||
bgc_fp64_vector3_multiply_by_real(unit_main, main, sqrt(1.0 / main_square_modulus));
|
||||
|
||||
bgc_fp64_vector3_add_scaled(unit_branch, branch, unit_main, -bgc_fp64_vector3_get_dot_product(branch, unit_main));
|
||||
|
||||
|
|
@ -347,7 +347,7 @@ static inline int _bgc_fp64_turn3_get_orthogonal_pair(BGC_FP64_Vector3* unit_mai
|
|||
return _BGC_ERROR_TURN3_PAIR_PARALLEL;
|
||||
}
|
||||
|
||||
bgc_fp64_vector3_multiply(unit_branch, unit_branch, sqrt(1.0 / orthogonal_square_modulus));
|
||||
bgc_fp64_vector3_multiply_by_real(unit_branch, unit_branch, sqrt(1.0 / orthogonal_square_modulus));
|
||||
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue