* License along with this library;
* if not, see <http://www.gnu.org/licenses/>.
*/
-#include "eina_private.h"
-#include "eina_bezier.h"
-
#include <math.h>
#include <float.h>
-#define FLOAT_CMP(a, b) (fabs(a - b) <= 0.01/* DBL_MIN */)
+#include "eina_private.h"
+#include "eina_bezier.h"
+#include "eina_util.h"
static void
_eina_bezier_1st_derivative(const Eina_Bezier *bz,
chord = _line_length(b->start.x, b->start.y, b->end.x, b->end.y);
- if (!FLOAT_CMP(len, chord)) {
+ if (!EINA_DBL_CMP(len, chord)) {
_eina_bezier_split(b, &left, &right); /* split in two */
_eina_bezier_length_helper(&left, length); /* try left side */
_eina_bezier_length_helper(&right, length); /* try right side */
double biggest = 1.0;
double t = 1.0;
- if (l > len || (FLOAT_CMP(len, l)))
+ if (l > len || (EINA_DBL_CMP(len, l)))
return t;
t *= 0.5;
_eina_bezier_split_left(&right, t, &left);
ll = eina_bezier_length_get(&left);
- if (FLOAT_CMP(ll, l))
+ if (EINA_DBL_CMP(ll, l))
break;
if (ll < l)
Eina_Bezier bezier;
double t;
- if (t0 == 0 && t1 == 1)
+ if (EINA_DBL_CMP(t0, 0.0) &&
+ EINA_DBL_CMP(t1, 1.0))
{
*result = *b;
return;