summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-12-19 12:10:51 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-12-19 16:33:46 -0800
commit3d0c4ac0f61e6032cf197946b3f0f6b1e4f3284f (patch)
treecfbe03b1c28bd1ade86597701064bab843e1f334 /src
parentd94a186584162f6159d5d422906e5e13b96461f2 (diff)
eina: fix double comparison in eina quaternion.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/eina_quaternion.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/eina/eina_quaternion.c b/src/lib/eina/eina_quaternion.c
index b9b73e2c98..93dbb31d7a 100644
--- a/src/lib/eina/eina_quaternion.c
+++ b/src/lib/eina/eina_quaternion.c
@@ -28,6 +28,7 @@
28#include "eina_fp.h" 28#include "eina_fp.h"
29#include "eina_matrix.h" 29#include "eina_matrix.h"
30#include "eina_quaternion.h" 30#include "eina_quaternion.h"
31#include "eina_util.h"
31 32
32EAPI void 33EAPI void
33eina_quaternion_f16p16_set(Eina_Quaternion *out, 34eina_quaternion_f16p16_set(Eina_Quaternion *out,
@@ -446,12 +447,12 @@ eina_quaternion_lerp(Eina_Quaternion *out,
446 const Eina_Quaternion *b, 447 const Eina_Quaternion *b,
447 double pos) 448 double pos)
448{ 449{
449 if (pos == 0) 450 if (EINA_DBL_CMP(pos, 0.0))
450 { 451 {
451 *out = *a; 452 *out = *a;
452 return ; 453 return ;
453 } 454 }
454 else if (pos == 1.0) 455 else if (EINA_DBL_CMP(pos, 1.0))
455 { 456 {
456 *out = *b; 457 *out = *b;
457 return ; 458 return ;
@@ -474,12 +475,12 @@ eina_quaternion_slerp(Eina_Quaternion *out,
474 double dot; 475 double dot;
475 double pos1, pos2; 476 double pos1, pos2;
476 477
477 if (pos == 0) 478 if (EINA_DBL_CMP(pos, 0.0))
478 { 479 {
479 *out = *a; 480 *out = *a;
480 return ; 481 return ;
481 } 482 }
482 else if (pos == 1.0) 483 else if (EINA_DBL_CMP(pos, 1.0))
483 { 484 {
484 *out = *b; 485 *out = *b;
485 return ; 486 return ;
@@ -527,12 +528,12 @@ eina_quaternion_nlerp(Eina_Quaternion *out,
527 Eina_Quaternion not_normalize; 528 Eina_Quaternion not_normalize;
528 double dot; 529 double dot;
529 530
530 if (pos == 0) 531 if (EINA_DBL_CMP(pos, 0.0))
531 { 532 {
532 *out = *a; 533 *out = *a;
533 return ; 534 return ;
534 } 535 }
535 else if (pos == 1.0) 536 else if (EINA_DBL_CMP(pos, 1.0))
536 { 537 {
537 *out = *b; 538 *out = *b;
538 return ; 539 return ;
@@ -691,7 +692,7 @@ eina_matrix4_quaternion_to(Eina_Quaternion *rotation,
691 Eina_Matrix4 n, pm; 692 Eina_Matrix4 n, pm;
692 double det, factor; 693 double det, factor;
693 694
694 if (m->ww == 0) return EINA_FALSE; 695 if (EINA_DBL_CMP(m->ww, 0.0)) return EINA_FALSE;
695 696
696 // Normalize the matrix. 697 // Normalize the matrix.
697 factor = 1 / m->ww; 698 factor = 1 / m->ww;
@@ -931,7 +932,7 @@ eina_quaternion_matrix4_to(Eina_Matrix4 *m,
931 932
932 // apply skew 933 // apply skew
933 // rm is a identity 4x4 matrix initially 934 // rm is a identity 4x4 matrix initially
934 if (skew->z) 935 if (!EINA_DBL_CMP(skew->z, 0.0))
935 { 936 {
936 Eina_Matrix4 cp; 937 Eina_Matrix4 cp;
937 938
@@ -942,7 +943,7 @@ eina_quaternion_matrix4_to(Eina_Matrix4 *m,
942 tmp = cp; 943 tmp = cp;
943 } 944 }
944 945
945 if (skew->y) 946 if (!EINA_DBL_CMP(skew->y, 0.0))
946 { 947 {
947 Eina_Matrix4 cp; 948 Eina_Matrix4 cp;
948 949
@@ -954,7 +955,7 @@ eina_quaternion_matrix4_to(Eina_Matrix4 *m,
954 tmp = cp; 955 tmp = cp;
955 } 956 }
956 957
957 if (skew->x) 958 if (!EINA_DBL_CMP(skew->x, 0.0))
958 { 959 {
959 Eina_Matrix4 cp; 960 Eina_Matrix4 cp;
960 961
@@ -1028,7 +1029,7 @@ eina_quaternion_copy(Eina_Quaternion *dst, const Eina_Quaternion *src)
1028EAPI void 1029EAPI void
1029eina_quaternion_homogeneous_regulate(Eina_Quaternion *out, const Eina_Quaternion *v) 1030eina_quaternion_homogeneous_regulate(Eina_Quaternion *out, const Eina_Quaternion *v)
1030{ 1031{
1031 if (v->w != 0.0) 1032 if (!EINA_DBL_CMP(v->w, 0.0))
1032 { 1033 {
1033 double scale = 1.0 / v->w; 1034 double scale = 1.0 / v->w;
1034 1035