/** * graphene_size_interpolate: * @a: a #graphene_size_t * @b: a #graphene_size_t * @factor: the linear interpolation factor * @res: (out caller-allocates): return location for the interpolated size * * Linearly interpolates the two given #graphene_size_t using the given * interpolation @factor. * * Since: 1.0 */ void graphene_size_interpolate (const graphene_size_t *a, const graphene_size_t *b, double factor, graphene_size_t *res) { res->width = graphene_lerp (a->width, b->width, factor); res->height = graphene_lerp (a->height, b->height, factor); }
/** * graphene_point_interpolate: * @a: a #graphene_point_t * @b: a #graphene_point_t * @factor: the linear interpolation factor * @res: (out caller-allocates): return location for the interpolated * point * * Linearly interpolates the coordinates of @a and @b using the * given @factor. * * Since: 1.0 */ void graphene_point_interpolate (const graphene_point_t *a, const graphene_point_t *b, double factor, graphene_point_t *res) { res->x = graphene_lerp (a->x, b->x, factor); res->y = graphene_lerp (a->y, b->y, factor); }
/** * graphene_rect_interpolate: * @a: a #graphene_rect_t * @b: a #graphene_rect_t * @factor: the linear interpolation factor * @res: (out caller-allocates): return location for the * interpolated rectangle * * Linearly interpolates the origin and size of the two given * rectangles. * * Since: 1.0 */ void graphene_rect_interpolate (const graphene_rect_t *a, const graphene_rect_t *b, double factor, graphene_rect_t *res) { graphene_rect_t ra, rb; ra = *a; graphene_rect_normalize_in_place (&ra); rb = *b; graphene_rect_normalize_in_place (&rb); res->origin.x = graphene_lerp (ra.origin.x, rb.origin.x, factor); res->origin.y = graphene_lerp (ra.origin.y, rb.origin.y, factor); res->size.width = graphene_lerp (ra.size.width, rb.size.width, factor); res->size.height = graphene_lerp (ra.size.height, rb.size.height, factor); }