Добавлены функции модуля для версоров и кватернионо / Functions of modulus have been added for versors and quaternions
This commit is contained in:
parent
bef7ab98f4
commit
03e390c1d0
12 changed files with 246 additions and 211 deletions
|
|
@ -8,19 +8,19 @@ float bg_fp32_vector2_get_angle(const BgFP32Vector2* vector1, const BgFP32Vector
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
const float square_module1 = bg_fp32_vector2_get_square_module(vector1);
|
||||
const float square_modulus1 = bg_fp32_vector2_get_square_modulus(vector1);
|
||||
|
||||
if (square_module1 <= BG_FP32_SQUARE_EPSYLON) {
|
||||
if (square_modulus1 <= BG_FP32_SQUARE_EPSYLON) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
const float square_module2 = bg_fp32_vector2_get_square_module(vector2);
|
||||
const float square_modulus2 = bg_fp32_vector2_get_square_modulus(vector2);
|
||||
|
||||
if (square_module2 <= BG_FP32_SQUARE_EPSYLON) {
|
||||
if (square_modulus2 <= BG_FP32_SQUARE_EPSYLON) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
const float cosine = bg_fp32_vector2_dot_product(vector1, vector2) / sqrtf(square_module1 * square_module2);
|
||||
const float cosine = bg_fp32_vector2_dot_product(vector1, vector2) / sqrtf(square_modulus1 * square_modulus2);
|
||||
|
||||
if (cosine >= 1.0f - BG_FP32_EPSYLON) {
|
||||
return 0.0f;
|
||||
|
|
@ -39,19 +39,19 @@ double bg_fp64_vector2_get_angle(const BgFP64Vector2* vector1, const BgFP64Vecto
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
const double square_module1 = bg_fp64_vector2_get_square_module(vector1);
|
||||
const double square_modulus1 = bg_fp64_vector2_get_square_modulus(vector1);
|
||||
|
||||
if (square_module1 <= BG_FP64_SQUARE_EPSYLON) {
|
||||
if (square_modulus1 <= BG_FP64_SQUARE_EPSYLON) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
const double square_module2 = bg_fp64_vector2_get_square_module(vector2);
|
||||
const double square_modulus2 = bg_fp64_vector2_get_square_modulus(vector2);
|
||||
|
||||
if (square_module2 <= BG_FP64_SQUARE_EPSYLON) {
|
||||
if (square_modulus2 <= BG_FP64_SQUARE_EPSYLON) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
const double cosine = bg_fp64_vector2_dot_product(vector1, vector2) / sqrt(square_module1 * square_module2);
|
||||
const double cosine = bg_fp64_vector2_dot_product(vector1, vector2) / sqrt(square_modulus1 * square_modulus2);
|
||||
|
||||
if (cosine >= 1.0 - BG_FP64_EPSYLON) {
|
||||
return 0.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue