summaryrefslogtreecommitdiff
path: root/src/lib/evas/include/evas_3d_utils.h
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-12-19 16:28:43 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-12-19 16:33:46 -0800
commit2ddbfb2329e9365d994709264f39ca59cf96b37c (patch)
tree8b038e2730d538919c17e9561393bc9150fffda3 /src/lib/evas/include/evas_3d_utils.h
parentae9257401e387f1d166c1974eb84edae3284a741 (diff)
evas: get rid of float comparison warning in Evas_3D.
Diffstat (limited to 'src/lib/evas/include/evas_3d_utils.h')
-rw-r--r--src/lib/evas/include/evas_3d_utils.h133
1 files changed, 66 insertions, 67 deletions
diff --git a/src/lib/evas/include/evas_3d_utils.h b/src/lib/evas/include/evas_3d_utils.h
index 3058eb6a27..6d3155ab6a 100644
--- a/src/lib/evas/include/evas_3d_utils.h
+++ b/src/lib/evas/include/evas_3d_utils.h
@@ -9,9 +9,6 @@
9#define EVAS_MATRIX_IS_IDENTITY 0x00000001 9#define EVAS_MATRIX_IS_IDENTITY 0x00000001
10#define MIN_DIFF 0.00000000001 10#define MIN_DIFF 0.00000000001
11 11
12#define FLT_COMPARISON(a, b) \
13 (fabs(a - b) > FLT_EPSILON)
14
15typedef struct _Evas_Color Evas_Color; 12typedef struct _Evas_Color Evas_Color;
16typedef struct _Evas_Box2 Evas_Box2; 13typedef struct _Evas_Box2 Evas_Box2;
17typedef struct _Evas_Box3 Evas_Box3; 14typedef struct _Evas_Box3 Evas_Box3;
@@ -87,11 +84,11 @@ evas_triangle3_is_line(Evas_Triangle3 *v)
87static inline Eina_Bool 84static inline Eina_Bool
88convex_hull_triangle3_not_first_edje(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Vector3 *b) 85convex_hull_triangle3_not_first_edje(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Vector3 *b)
89{ 86{
90 if (((v->p1.x == a->x) && (v->p1.y == a->y) && (v->p1.z == a->z)) && 87 if ((EINA_DBL_CMP(v->p1.x, a->x) && EINA_DBL_CMP(v->p1.y, a->y) && EINA_DBL_CMP(v->p1.z, a->z)) &&
91 ((v->p2.x == b->x) && (v->p2.y == b->y) && (v->p2.z == b->z))) 88 (EINA_DBL_CMP(v->p2.x, b->x) && EINA_DBL_CMP(v->p2.y, b->y) && EINA_DBL_CMP(v->p2.z, b->z)))
92 return EINA_TRUE; 89 return EINA_TRUE;
93 else if (((v->p2.x == a->x) && (v->p2.y == a->y) && (v->p2.z == a->z)) && 90 else if ((EINA_DBL_CMP(v->p2.x, a->x) && EINA_DBL_CMP(v->p2.y, a->y) && EINA_DBL_CMP(v->p2.z, a->z)) &&
94 ((v->p1.x == b->x) && (v->p1.y == b->y) && (v->p1.z == b->z))) 91 (EINA_DBL_CMP(v->p1.x, b->x) && EINA_DBL_CMP(v->p1.y, b->y) && EINA_DBL_CMP(v->p1.z, b->z)))
95 return EINA_TRUE; 92 return EINA_TRUE;
96 93
97 return EINA_FALSE; 94 return EINA_FALSE;
@@ -100,13 +97,13 @@ convex_hull_triangle3_not_first_edje(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Ve
100static inline Eina_Bool 97static inline Eina_Bool
101convex_hull_triangle3_first_edje(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Vector3 *b) 98convex_hull_triangle3_first_edje(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Vector3 *b)
102{ 99{
103 if ((!FLT_COMPARISON(v->p0.x, a->x) && !FLT_COMPARISON(v->p0.y, a->y) && 100 if ((!EINA_FLT_CMP(v->p0.x, a->x) && !EINA_FLT_CMP(v->p0.y, a->y) &&
104 !FLT_COMPARISON(v->p0.z, a->z)) && (!FLT_COMPARISON(v->p1.x, b->x) && 101 !EINA_FLT_CMP(v->p0.z, a->z)) && (!EINA_FLT_CMP(v->p1.x, b->x) &&
105 !FLT_COMPARISON(v->p1.y, b->y) && !FLT_COMPARISON(v->p1.z, b->z))) 102 !EINA_FLT_CMP(v->p1.y, b->y) && !EINA_FLT_CMP(v->p1.z, b->z)))
106 return EINA_TRUE; 103 return EINA_TRUE;
107 else if ((!FLT_COMPARISON(v->p1.x, a->x) && !FLT_COMPARISON(v->p1.y, a->y) && 104 else if ((!EINA_FLT_CMP(v->p1.x, a->x) && !EINA_FLT_CMP(v->p1.y, a->y) &&
108 !FLT_COMPARISON(v->p1.z, a->z)) && (!FLT_COMPARISON(v->p0.x, b->x) && 105 !EINA_FLT_CMP(v->p1.z, a->z)) && (!EINA_FLT_CMP(v->p0.x, b->x) &&
109 !FLT_COMPARISON(v->p0.y, b->y) && !FLT_COMPARISON(v->p0.z, b->z))) 106 !EINA_FLT_CMP(v->p0.y, b->y) && !EINA_FLT_CMP(v->p0.z, b->z)))
110 return EINA_TRUE; 107 return EINA_TRUE;
111 108
112 return EINA_FALSE; 109 return EINA_FALSE;
@@ -115,16 +112,16 @@ convex_hull_triangle3_first_edje(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Vector
115static inline Eina_Bool 112static inline Eina_Bool
116convex_hull_triangle3_first_point(Evas_Triangle3 *v, Eina_Vector3 *a) 113convex_hull_triangle3_first_point(Evas_Triangle3 *v, Eina_Vector3 *a)
117{ 114{
118 return ((v->p0.x == a->x) && (v->p0.y == a->y) && (v->p0.z == a->z)); 115 return (EINA_DBL_CMP(v->p0.x, a->x) && EINA_DBL_CMP(v->p0.y, a->y) && EINA_DBL_CMP(v->p0.z, a->z));
119} 116}
120 117
121static inline Eina_Bool 118static inline Eina_Bool
122eina_vector3_equivalent_as_triangle(Eina_Vector3 *v0, Eina_Vector3 *v1, Eina_Vector3 *v2, 119eina_vector3_equivalent_as_triangle(Eina_Vector3 *v0, Eina_Vector3 *v1, Eina_Vector3 *v2,
123 Eina_Vector3 *w0, Eina_Vector3 *w1, Eina_Vector3 *w2) 120 Eina_Vector3 *w0, Eina_Vector3 *w1, Eina_Vector3 *w2)
124{ 121{
125 if (((v0->x == w0->x) && (v0->y == w0->y) && (v0->z == w0->z)) && 122 if ((EINA_DBL_CMP(v0->x, w0->x) && EINA_DBL_CMP(v0->y, w0->y) && EINA_DBL_CMP(v0->z, w0->z)) &&
126 ((v1->x == w1->x) && (v1->y == w1->y) && (v1->z == w1->z)) && 123 (EINA_DBL_CMP(v1->x, w1->x) && EINA_DBL_CMP(v1->y, w1->y) && EINA_DBL_CMP(v1->z, w1->z)) &&
127 ((v2->x == w2->x) && (v2->y == w2->y) && (v2->z == w2->z))) 124 (EINA_DBL_CMP(v2->x, w2->x) && EINA_DBL_CMP(v2->y, w2->y) && EINA_DBL_CMP(v2->z, w2->z)))
128 return EINA_TRUE; 125 return EINA_TRUE;
129 126
130 return EINA_FALSE; 127 return EINA_FALSE;
@@ -440,7 +437,7 @@ evas_box2_intersect_2d(const Evas_Box2 *box, const Eina_Vector2 *org, const Eina
440 return EINA_TRUE; 437 return EINA_TRUE;
441 } 438 }
442 /* minmax algorithm of ray and box intersection */ 439 /* minmax algorithm of ray and box intersection */
443 if ((dir->x != 0.0f) && (dir->y != 0.0f)) 440 if (!EINA_DBL_CMP(dir->x, 0.0) && !EINA_DBL_CMP(dir->y, 0.0))
444 { 441 {
445 t1 = (box->p0.x - org->x) / dir->x; 442 t1 = (box->p0.x - org->x) / dir->x;
446 t2 = (box->p1.x - org->x) / dir->x; 443 t2 = (box->p1.x - org->x) / dir->x;
@@ -475,7 +472,7 @@ evas_box2_intersect_2d(const Evas_Box2 *box, const Eina_Vector2 *org, const Eina
475 return EINA_FALSE; 472 return EINA_FALSE;
476 } 473 }
477 /* case when ray is parallel to one of axes */ 474 /* case when ray is parallel to one of axes */
478 else if (dir->x == 0.0f) 475 else if (EINA_DBL_CMP(dir->x, 0.0))
479 { 476 {
480 if ((org->x < box->p0.x) && (org->x > box->p1.x)) 477 if ((org->x < box->p0.x) && (org->x > box->p1.x))
481 return EINA_FALSE; 478 return EINA_FALSE;
@@ -514,7 +511,7 @@ evas_box3_ray3_intersect(const Evas_Box3 *box, const Evas_Ray3 *ray)
514 return EINA_TRUE; 511 return EINA_TRUE;
515 } 512 }
516 /* minmax algorithm of ray and box intersection */ 513 /* minmax algorithm of ray and box intersection */
517 if ((ray->dir.x != 0.0f) && (ray->dir.y != 0.0f) && (ray->dir.z != 0.0f)) 514 if (!EINA_DBL_CMP(ray->dir.x, 0.0) && !EINA_DBL_CMP(ray->dir.y, 0.0) && !EINA_DBL_CMP(ray->dir.z, 0.0))
518 { 515 {
519 t1 = (box->p0.x - ray->org.x) / ray->dir.x; 516 t1 = (box->p0.x - ray->org.x) / ray->dir.x;
520 t2 = (box->p1.x - ray->org.x) / ray->dir.x; 517 t2 = (box->p1.x - ray->org.x) / ray->dir.x;
@@ -570,7 +567,7 @@ evas_box3_ray3_intersect(const Evas_Box3 *box, const Evas_Ray3 *ray)
570 else 567 else
571 { 568 {
572 /* use two-dimensional version here */ 569 /* use two-dimensional version here */
573 if (ray->dir.x == 0.0f) 570 if (EINA_DBL_CMP(ray->dir.x, 0.0))
574 { 571 {
575 if ((ray->org.x < box->p0.x) || (ray->org.x > box->p1.x)) 572 if ((ray->org.x < box->p0.x) || (ray->org.x > box->p1.x))
576 return EINA_FALSE; 573 return EINA_FALSE;
@@ -583,7 +580,7 @@ evas_box3_ray3_intersect(const Evas_Box3 *box, const Evas_Ray3 *ray)
583 } 580 }
584 } 581 }
585 582
586 if (ray->dir.y == 0.0f) 583 if (EINA_DBL_CMP(ray->dir.y, 0.0))
587 { 584 {
588 if ((ray->org.y < box->p0.y) || (ray->org.y > box->p1.y)) 585 if ((ray->org.y < box->p0.y) || (ray->org.y > box->p1.y))
589 return EINA_FALSE; 586 return EINA_FALSE;
@@ -596,7 +593,7 @@ evas_box3_ray3_intersect(const Evas_Box3 *box, const Evas_Ray3 *ray)
596 } 593 }
597 } 594 }
598 595
599 if (ray->dir.z == 0.0f) 596 if (EINA_DBL_CMP(ray->dir.z, 0.0))
600 { 597 {
601 if (ray->org.z < box->p0.z || ray->org.z > box->p1.z) 598 if (ray->org.z < box->p0.z || ray->org.z > box->p1.z)
602 return EINA_FALSE; 599 return EINA_FALSE;
@@ -675,11 +672,11 @@ evas_intersection_line_of_two_plains(Evas_Line3 *line, Eina_Quaternion *plane1,
675 line->point.y = (plane2->w * plane1->z - plane1->w * plane2->z) / line->direction.x; \ 672 line->point.y = (plane2->w * plane1->z - plane1->w * plane2->z) / line->direction.x; \
676 line->point.z = (plane2->y * plane1->w - plane1->y * plane2->w) / line->direction.x; 673 line->point.z = (plane2->y * plane1->w - plane1->y * plane2->w) / line->direction.x;
677 674
678 if (line->direction.x && plane1->z) 675 if (!EINA_DBL_CMP(line->direction.x, 0.0) && !EINA_DBL_CMP(plane1->z, 0.0))
679 { 676 {
680 SOLVE_EQUATION(x, y, z) 677 SOLVE_EQUATION(x, y, z)
681 } 678 }
682 else if (line->direction.y && plane1->x) 679 else if (!EINA_DBL_CMP(line->direction.y, 0.0) && !EINA_DBL_CMP(plane1->x, 0.0))
683 { 680 {
684 SOLVE_EQUATION(y, z, x) 681 SOLVE_EQUATION(y, z, x)
685 } 682 }
@@ -898,7 +895,7 @@ tangent_new_basis(Eina_Vector3 *out, Evas_Triangle3 *triangle,
898 895
899 896
900 /* calculation of new basis(in system coordinates of texturing) by solution of system of equations */ 897 /* calculation of new basis(in system coordinates of texturing) by solution of system of equations */
901 if (new2.y != 0) 898 if (!EINA_DBL_CMP(new2.y, 0.0))
902 { 899 {
903 eina_vector3_scale(&old2, &old2, (new1.y / new2.y)); 900 eina_vector3_scale(&old2, &old2, (new1.y / new2.y));
904 eina_vector2_scale(&new2, &new2, (new1.y / new2.y)); 901 eina_vector2_scale(&new2, &new2, (new1.y / new2.y));
@@ -909,7 +906,7 @@ tangent_new_basis(Eina_Vector3 *out, Evas_Triangle3 *triangle,
909 eina_vector3_scale(out, &old1, 1 / new1.x); 906 eina_vector3_scale(out, &old1, 1 / new1.x);
910 } 907 }
911 908
912 else if (new1.y != 0) 909 else if (!EINA_DBL_CMP(new1.y, 0.0))
913 { 910 {
914 eina_vector3_scale(&old1, &old1, (new2.y / new1.y)); 911 eina_vector3_scale(&old1, &old1, (new2.y / new1.y));
915 eina_vector2_scale(&new1, &new1, (new2.y / new1.y)); 912 eina_vector2_scale(&new1, &new1, (new2.y / new1.y));
@@ -980,8 +977,8 @@ convex_hull_first_tr_get(float *data, int count, int stride)
980 for (i = 1, j = stride; i < count; i++, j += stride) 977 for (i = 1, j = stride; i < count; i++, j += stride)
981 { 978 {
982 if ((triangle1.z > data[j + 2]) || 979 if ((triangle1.z > data[j + 2]) ||
983 ((triangle1.z == data[j + 2]) && (triangle1.y > data[j + 1])) || 980 ((EINA_FLT_CMP(triangle1.z, data[j + 2])) && (triangle1.y > data[j + 1])) ||
984 ((triangle1.z == data[j + 2]) && (triangle1.y == data[j + 1]) && (triangle1.x > data[j]))) 981 ((EINA_FLT_CMP(triangle1.z, data[j + 2])) && (EINA_FLT_CMP(triangle1.y, data[j + 1])) && (triangle1.x > data[j])))
985 { 982 {
986 eina_vector3_set(&triangle1, data[j], data[j + 1], data[j + 2]); 983 eina_vector3_set(&triangle1, data[j], data[j + 1], data[j + 2]);
987 first_num = i; 984 first_num = i;
@@ -1003,7 +1000,7 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1003 cos_2d = new_cos_2d; \ 1000 cos_2d = new_cos_2d; \
1004 eina_vector3_set(&triangle, data[j], data[j + 1], data[j + 2]); \ 1001 eina_vector3_set(&triangle, data[j], data[j + 1], data[j + 2]); \
1005 } \ 1002 } \
1006 else if(!FLT_COMPARISON(little, big) && \ 1003 else if(!EINA_FLT_CMP(little, big) && \
1007 (eina_vector3_distance_get(&triangle##_candidate, &previous) > \ 1004 (eina_vector3_distance_get(&triangle##_candidate, &previous) > \
1008 eina_vector3_distance_get(&triangle, &previous))) \ 1005 eina_vector3_distance_get(&triangle, &previous))) \
1009 { \ 1006 { \
@@ -1012,9 +1009,9 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1012 eina_vector3_set(&complanar1, 1, 0, 0); 1009 eina_vector3_set(&complanar1, 1, 0, 0);
1013 for (i = 0, j = 0; i < count; i++, j += stride) 1010 for (i = 0, j = 0; i < count; i++, j += stride)
1014 { 1011 {
1015 if (FLT_COMPARISON(data[j], triangle1.x) || 1012 if (EINA_FLT_CMP(data[j], triangle1.x) ||
1016 FLT_COMPARISON(data[j + 1], triangle1.y) || 1013 EINA_FLT_CMP(data[j + 1], triangle1.y) ||
1017 FLT_COMPARISON(data[j + 2], triangle1.z)) 1014 EINA_FLT_CMP(data[j + 2], triangle1.z))
1018 { 1015 {
1019 eina_vector3_set(&triangle2_candidate, data[j], data[j + 1], data[j + 2]); 1016 eina_vector3_set(&triangle2_candidate, data[j], data[j + 1], data[j + 2]);
1020 eina_vector3_subtract(&diagonal, &triangle2_candidate, &triangle1); 1017 eina_vector3_subtract(&diagonal, &triangle2_candidate, &triangle1);
@@ -1027,7 +1024,7 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1027 eina_vector3_subtract(&diagonal, &triangle2, &triangle1); 1024 eina_vector3_subtract(&diagonal, &triangle2, &triangle1);
1028 cos_2d = eina_vector3_angle_get(&complanar1, &diagonal); 1025 cos_2d = eina_vector3_angle_get(&complanar1, &diagonal);
1029 } 1026 }
1030 else if (!FLT_COMPARISON(sin, new_sin)) 1027 else if (!EINA_FLT_CMP(sin, new_sin))
1031 { 1028 {
1032 eina_vector3_subtract(&diagonal, &triangle2_candidate, &triangle1); 1029 eina_vector3_subtract(&diagonal, &triangle2_candidate, &triangle1);
1033 new_cos_2d = eina_vector3_angle_get(&complanar1, &diagonal); 1030 new_cos_2d = eina_vector3_angle_get(&complanar1, &diagonal);
@@ -1053,12 +1050,12 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1053 { 1050 {
1054 eina_vector3_set(&candidate, data[j], data[j + 1], data[j + 2]); 1051 eina_vector3_set(&candidate, data[j], data[j + 1], data[j + 2]);
1055 1052
1056 if ((FLT_COMPARISON(data[j], triangle1.x) || 1053 if ((EINA_FLT_CMP(data[j], triangle1.x) ||
1057 FLT_COMPARISON(data[j + 1], triangle1.y) || 1054 EINA_FLT_CMP(data[j + 1], triangle1.y) ||
1058 FLT_COMPARISON(data[j + 2], triangle1.z)) && 1055 EINA_FLT_CMP(data[j + 2], triangle1.z)) &&
1059 (FLT_COMPARISON(data[j], triangle2.x) || 1056 (EINA_FLT_CMP(data[j], triangle2.x) ||
1060 FLT_COMPARISON(data[j + 1], triangle2.y) || 1057 EINA_FLT_CMP(data[j + 1], triangle2.y) ||
1061 FLT_COMPARISON(data[j + 2], triangle2.z))) 1058 EINA_FLT_CMP(data[j + 2], triangle2.z)))
1062 { 1059 {
1063 eina_vector3_plane_by_points(&normal_b, &triangle1, &candidate, &triangle2); 1060 eina_vector3_plane_by_points(&normal_b, &triangle1, &candidate, &triangle2);
1064 1061
@@ -1076,7 +1073,7 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1076 eina_vector3_set(&triangle3, data[j], data[j + 1], data[j + 2]); 1073 eina_vector3_set(&triangle3, data[j], data[j + 1], data[j + 2]);
1077 cos_2d = eina_vector3_angle_get(&diagonal, &first); 1074 cos_2d = eina_vector3_angle_get(&diagonal, &first);
1078 } 1075 }
1079 else if (!FLT_COMPARISON(new_cos, cos)) 1076 else if (!EINA_FLT_CMP(new_cos, cos))
1080 { 1077 {
1081 eina_vector3_set(&triangle3_candidate, data[j], data[j + 1], data[j + 2]); 1078 eina_vector3_set(&triangle3_candidate, data[j], data[j + 1], data[j + 2]);
1082 eina_vector3_subtract(&first, &triangle1, &triangle2); 1079 eina_vector3_subtract(&first, &triangle1, &triangle2);
@@ -1159,11 +1156,11 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1159 and one new vertex, all vertices should be checked */ 1156 and one new vertex, all vertices should be checked */
1160 for (i = 0, j = 0; i < count; i++, j += stride) 1157 for (i = 0, j = 0; i < count; i++, j += stride)
1161 { 1158 {
1162 if ((FLT_COMPARISON(elem->p0.x, data[j]) || FLT_COMPARISON(elem->p0.y, data[j + 1]) || 1159 if ((EINA_FLT_CMP(elem->p0.x, data[j]) || EINA_FLT_CMP(elem->p0.y, data[j + 1]) ||
1163 FLT_COMPARISON(elem->p0.z, data[j + 2])) && (FLT_COMPARISON(elem->p1.x, data[j]) || 1160 EINA_FLT_CMP(elem->p0.z, data[j + 2])) && (EINA_FLT_CMP(elem->p1.x, data[j]) ||
1164 FLT_COMPARISON(elem->p1.y, data[j + 1]) || FLT_COMPARISON(elem->p1.z, data[j + 2])) && 1161 EINA_FLT_CMP(elem->p1.y, data[j + 1]) || EINA_FLT_CMP(elem->p1.z, data[j + 2])) &&
1165 (FLT_COMPARISON(elem->p2.x, data[j]) || FLT_COMPARISON(elem->p2.y, data[j + 1]) || 1162 (EINA_FLT_CMP(elem->p2.x, data[j]) || EINA_FLT_CMP(elem->p2.y, data[j + 1]) ||
1166 FLT_COMPARISON(elem->p2.z, data[j + 2]))) 1163 EINA_FLT_CMP(elem->p2.z, data[j + 2])))
1167 { 1164 {
1168 next = malloc(sizeof(Eina_Vector3)); 1165 next = malloc(sizeof(Eina_Vector3));
1169 eina_vector3_set(next, data[j], data[j + 1], data[j + 2]); 1166 eina_vector3_set(next, data[j], data[j + 1], data[j + 2]);
@@ -1237,7 +1234,7 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1237 /* The case when several points are found, is discussed below. 1234 /* The case when several points are found, is discussed below.
1238 This case is interesting because the convex hull in the 1235 This case is interesting because the convex hull in the
1239 two-dimensional subspace should be filled further */ 1236 two-dimensional subspace should be filled further */
1240 if ((cos != 1.0) && (1 < eina_array_count(&arr_candidates))) 1237 if ((!EINA_FLT_CMP(cos, 1.0)) && (1 < eina_array_count(&arr_candidates)))
1241 { 1238 {
1242 Eina_Vector3 angle_from, angle_to; 1239 Eina_Vector3 angle_from, angle_to;
1243 next_2d = eina_array_data_get(&arr_candidates, 0); 1240 next_2d = eina_array_data_get(&arr_candidates, 0);
@@ -1268,7 +1265,7 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1268 cos_2d = new_cos; 1265 cos_2d = new_cos;
1269 best = eina_array_data_get(&arr_candidates, k); 1266 best = eina_array_data_get(&arr_candidates, k);
1270 } 1267 }
1271 else if (!FLT_COMPARISON(new_cos, cos_2d)) 1268 else if (!EINA_FLT_CMP(new_cos, cos_2d))
1272 { 1269 {
1273 if ((right && (eina_vector3_distance_get(best, &elem->p0) < eina_vector3_length_get(&angle_from))) || 1270 if ((right && (eina_vector3_distance_get(best, &elem->p0) < eina_vector3_length_get(&angle_from))) ||
1274 (!right && (eina_vector3_distance_get(best, &elem->p1) < eina_vector3_length_get(&angle_from)))) 1271 (!right && (eina_vector3_distance_get(best, &elem->p1) < eina_vector3_length_get(&angle_from))))
@@ -1280,7 +1277,7 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1280 /* This event will take place after the previous, 1277 /* This event will take place after the previous,
1281 in fact, choice of first triangle in a new two-dimensional 1278 in fact, choice of first triangle in a new two-dimensional
1282 convex hull allows to fill it fan counterclockwise when viewed from the inside */ 1279 convex hull allows to fill it fan counterclockwise when viewed from the inside */
1283 else if ((cos == 1.0) && (1 < eina_array_count(&arr_candidates))) 1280 else if ((EINA_FLT_CMP(cos, 1.0)) && (1 < eina_array_count(&arr_candidates)))
1284 { 1281 {
1285 Eina_Vector3 angle_from, angle_to; 1282 Eina_Vector3 angle_from, angle_to;
1286 eina_vector3_subtract(&angle_from, &elem->p0, &elem->p1); 1283 eina_vector3_subtract(&angle_from, &elem->p0, &elem->p1);
@@ -1300,7 +1297,7 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1300 cos_2d = new_cos; 1297 cos_2d = new_cos;
1301 best = eina_array_data_get(&arr_candidates, k); 1298 best = eina_array_data_get(&arr_candidates, k);
1302 } 1299 }
1303 else if (!FLT_COMPARISON(new_cos, cos_2d)) 1300 else if (!EINA_FLT_CMP(new_cos, cos_2d))
1304 { 1301 {
1305 if (eina_vector3_distance_get(best, &elem->p0) < eina_vector3_length_get(&angle_to)) 1302 if (eina_vector3_distance_get(best, &elem->p0) < eina_vector3_length_get(&angle_to))
1306 best = eina_array_data_get(&arr_candidates, k); 1303 best = eina_array_data_get(&arr_candidates, k);
@@ -1404,21 +1401,21 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1404 found_index = (unsigned short int*) malloc(index_count * sizeof(unsigned short int)); 1401 found_index = (unsigned short int*) malloc(index_count * sizeof(unsigned short int));
1405 j = 0; 1402 j = 0;
1406 1403
1407#define CHECK_AND_SET_VERTEX(coord) \ 1404#define CHECK_AND_SET_VERTEX(coord) \
1408 exist1 = EINA_FALSE; \ 1405 exist1 = EINA_FALSE; \
1409 for (i = 0, new_stride = 0; (i < vertex_count) && !exist1; i++, new_stride += 10) \ 1406 for (i = 0, new_stride = 0; (i < vertex_count) && !exist1; i++, new_stride += 10) \
1410 { \ 1407 { \
1411 if ((k > 0) && !FLT_COMPARISON(el->p##coord.x, found_vertex[new_stride]) && \ 1408 if ((k > 0) && !EINA_FLT_CMP(el->p##coord.x, found_vertex[new_stride]) && \
1412 !FLT_COMPARISON(el->p##coord.y, found_vertex[new_stride + 1]) && \ 1409 !EINA_FLT_CMP(el->p##coord.y, found_vertex[new_stride + 1]) && \
1413 !FLT_COMPARISON(el->p##coord.z, found_vertex[new_stride + 2])) \ 1410 !EINA_FLT_CMP(el->p##coord.z, found_vertex[new_stride + 2])) \
1414 { \ 1411 { \
1415 exist1 = EINA_TRUE; \ 1412 exist1 = EINA_TRUE; \
1416 found_index[3 * k + coord] = i; \ 1413 found_index[3 * k + coord] = i; \
1417 } \ 1414 } \
1418 } \ 1415 } \
1419 if (!exist1) \ 1416 if (!exist1) \
1420 convex_hull_vertex_set(el, &vertex_count, &found_vertex, \ 1417 convex_hull_vertex_set(el, &vertex_count, &found_vertex, \
1421 &found_index, k, &leader, coord); 1418 &found_index, k, &leader, coord);
1422 1419
1423 EINA_ARRAY_ITER_NEXT(&arr_ch, k, el, iterator) 1420 EINA_ARRAY_ITER_NEXT(&arr_ch, k, el, iterator)
1424 { 1421 {
@@ -1539,8 +1536,10 @@ evas_tangent_space_get(float *data, float *tex_data, float *normal_data, unsigne
1539 if ((fabs(data[j] - data[m]) < FLT_EPSILON) && 1536 if ((fabs(data[j] - data[m]) < FLT_EPSILON) &&
1540 (fabs(data[j + 1] - data[m + 1]) < FLT_EPSILON) && 1537 (fabs(data[j + 1] - data[m + 1]) < FLT_EPSILON) &&
1541 (fabs(data[j + 2] - data[m + 2]) < FLT_EPSILON) && 1538 (fabs(data[j + 2] - data[m + 2]) < FLT_EPSILON) &&
1542 ((m == j) || ((tex_data[i * tex_stride] != 0.0) && (tex_data[i * tex_stride + 1] != 0.0) && 1539 ((m == j) || ((!EINA_FLT_CMP(tex_data[i * tex_stride], 0.0)) &&
1543 (tex_data[i * tex_stride] != 1.0) && (tex_data[i * tex_stride + 1] != 1.0)))) 1540 !EINA_FLT_CMP(tex_data[i * tex_stride + 1], 0.0) &&
1541 !EINA_FLT_CMP(tex_data[i * tex_stride], 1.0) &&
1542 !EINA_FLT_CMP(tex_data[i * tex_stride + 1], 1.0))))
1544 { 1543 {
1545 found_index = l; 1544 found_index = l;
1546 for (k = 0; k < index_count; k += 3) 1545 for (k = 0; k < index_count; k += 3)