void gimp_coords_difference (const GimpCoords *a, const GimpCoords *b, GimpCoords *ret_difference) { gimp_coords_mix (1.0, a, -1.0, b, ret_difference); }
void gimp_coords_average (const GimpCoords *a, const GimpCoords *b, GimpCoords *ret_average) { gimp_coords_mix (0.5, a, 0.5, b, ret_average); }
void gimp_coords_add (const GimpCoords *a, const GimpCoords *b, GimpCoords *ret_add) { gimp_coords_mix (1.0, a, 1.0, b, ret_add); }
void gimp_coords_scale (const gdouble f, const GimpCoords *a, GimpCoords *ret_product) { gimp_coords_mix (f, a, 0.0, NULL, ret_product); }
gboolean gimp_coords_bezier_is_straight (const GimpCoords bezier_pt1, const GimpCoords bezier_pt2, const GimpCoords bezier_pt3, const GimpCoords bezier_pt4, gdouble precision) { GimpCoords pt1, pt2; /* calculate the "ideal" positions for the control points */ gimp_coords_mix (2.0 / 3.0, &bezier_pt1, 1.0 / 3.0, &bezier_pt4, &pt1); gimp_coords_mix (1.0 / 3.0, &bezier_pt1, 2.0 / 3.0, &bezier_pt4, &pt2); /* calculate the deviation of the actual control points */ return (gimp_coords_manhattan_dist (&bezier_pt2, &pt1) < precision && gimp_coords_manhattan_dist (&bezier_pt3, &pt2) < precision); }