if (w) *w = xmax - xmin;
if (h) *h = ymax - ymin;
}
+
+EAPI void
+eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *result)
+{
+ Eina_Bezier bezier;
+ double t;
+
+ if (t0 == 0 && t1 == 1)
+ {
+ *result = *b;
+ return;
+ }
+
+ bezier = *b;
+ _eina_bezier_split_left(&bezier, t0, result);
+ t = (t1-t0)/(1-t0);
+ _eina_bezier_split_left(&bezier, t, result);
+}
*/
EAPI void eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, double *h) EINA_ARG_NONNULL(1);
+/**
+ * @brief find the bezier at given interval.
+ *
+ * @param b The floating point bezier.
+ * @param t0 The start interval.
+ * @param t1 The end interval.
+ * @param result The result bezier.
+ *
+ * @p b. No check is done on @p b.
+ * @since 1.16
+ */
+EAPI void eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *result);
+
#endif // EINA_BEZIER_H
}
END_TEST
+START_TEST(eina_bezier_test_on_interval)
+{
+ Eina_Bezier b, res;
+ double px1, px2, py1, py2;
+
+ eina_init();
+ eina_bezier_values_set(&b,
+ 0, 0,
+ 10, 20,
+ 20, 90,
+ 30, 0);
+ eina_bezier_point_at(&b, 0.25, &px1, &py1);
+ eina_bezier_on_interval(&b, 0.25, 0.5, &res);
+ eina_bezier_point_at(&res, 0, &px2, &py2);
+
+ fail_if(px1 != px2 || py1 != py2);
+
+ eina_shutdown();
+}
+END_TEST
+
void
eina_test_bezier(TCase *tc)
{
tcase_add_test(tc, eina_bezier_test_point_at);
tcase_add_test(tc, eina_bezier_test_split_at_length);
tcase_add_test(tc, eina_bezier_test_bounds_get);
+ tcase_add_test(tc, eina_bezier_test_on_interval);
}