diff --git a/gsk/gskcurve.c b/gsk/gskcurve.c index 0cfe34e4f4..a9c7c96132 100644 --- a/gsk/gskcurve.c +++ b/gsk/gskcurve.c @@ -1625,6 +1625,19 @@ gsk_curve_get_tangent (const GskCurve *curve, get_class (curve->op)->get_tangent (curve, progress, tangent); } +void +gsk_curve_get_normal (const GskCurve *curve, + float t, + graphene_vec2_t *normal) +{ + graphene_vec2_t tangent; + + gsk_curve_get_tangent (curve, t, &tangent); + graphene_vec2_init (normal, + - graphene_vec2_get_y (&tangent), + graphene_vec2_get_x (&tangent)); +} + void gsk_curve_split (const GskCurve *curve, float progress, diff --git a/gsk/gskcurveprivate.h b/gsk/gskcurveprivate.h index 5ab9a9bfec..c76d3c796d 100644 --- a/gsk/gskcurveprivate.h +++ b/gsk/gskcurveprivate.h @@ -123,6 +123,9 @@ void gsk_curve_get_point (const GskCurve void gsk_curve_get_tangent (const GskCurve *curve, float progress, graphene_vec2_t *tangent); +void gsk_curve_get_normal (const GskCurve *curve, + float progress, + graphene_vec2_t *normal); void gsk_curve_split (const GskCurve *curve, float progress, GskCurve *start,