[gtk/path-work-rebased: 100/118] Add gsk_curve_get_normal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/path-work-rebased: 100/118] Add gsk_curve_get_normal
- Date: Sat, 4 Dec 2021 07:28:38 +0000 (UTC)
commit a805362f10137c4eea3b7a84a5ad7e034fdb4b7e
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Dec 23 13:36:19 2020 -0500
Add gsk_curve_get_normal
Its easy but thats no reason not to have this api.
gsk/gskcurve.c | 13 +++++++++++++
gsk/gskcurveprivate.h | 3 +++
2 files changed, 16 insertions(+)
---
diff --git a/gsk/gskcurve.c b/gsk/gskcurve.c
index 187f11a0ff..4ad033d025 100644
--- a/gsk/gskcurve.c
+++ b/gsk/gskcurve.c
@@ -430,6 +430,19 @@ gsk_curve_curve_get_tangent (const GskCurve *curve,
graphene_vec2_normalize (tangent, 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));
+}
+
static void
gsk_curve_curve_split (const GskCurve *curve,
float progress,
diff --git a/gsk/gskcurveprivate.h b/gsk/gskcurveprivate.h
index 0f721e2016..3d454896c9 100644
--- a/gsk/gskcurveprivate.h
+++ b/gsk/gskcurveprivate.h
@@ -96,6 +96,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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]