# [Bf-blender-cvs] [a25a334d454] hair_guides_grooming: Utility functions for curvature, for later use in hair guide curl effect.

Thu Jun 28 10:10:15 CEST 2018

```Commit: a25a334d454279c2b45437e3cae4fc1ceb9d2746
Author: Lukas Tönne
Date:   Thu Jun 28 09:09:23 2018 +0100
Branches: hair_guides_grooming
https://developer.blender.org/rBa25a334d454279c2b45437e3cae4fc1ceb9d2746

Utility functions for curvature, for later use in hair guide curl effect.

===================================================================

M	source/blender/blenkernel/intern/groom.c

===================================================================

diff --git a/source/blender/blenkernel/intern/groom.c b/source/blender/blenkernel/intern/groom.c
index 3d62f827720..44db8a27daf 100644
--- a/source/blender/blenkernel/intern/groom.c
+++ b/source/blender/blenkernel/intern/groom.c
@@ -163,12 +163,9 @@ BLI_INLINE void groom_forward_diff_init_hermite(
/* Calculate next cubic polynomial point using forward differencing */
BLI_INLINE void groom_forward_diff_step(double q[4][3])
{
-	for (int k = 0; k < 3; ++k)
-	{
-		q[0][k] += q[1][k];
-		q[1][k] += q[2][k];
-		q[2][k] += q[3][k];
-	}
}

/* Get the current point */
@@ -179,6 +176,22 @@ BLI_INLINE void groom_forward_diff_get_point(const double q[4][3], float r_p[3])
r_p[2] = (float)q[0][2];
}

+/* Get the current 1st derivative */
+BLI_INLINE void groom_forward_diff_get_tangent(const double q[4][3], float r_dp[3])
+{
+	r_dp[0] = (float)q[1][0];
+	r_dp[1] = (float)q[1][1];
+	r_dp[2] = (float)q[1][2];
+}
+
+/* Get the current 2nd derivative */
+BLI_INLINE void groom_forward_diff_get_curvature(const double q[4][3], float r_ddp[3])
+{
+	r_ddp[0] = (float)q[2][0];
+	r_ddp[1] = (float)q[2][1];
+	r_ddp[2] = (float)q[2][2];
+}
+
/* Calculate full array of cubic polynomial points using forward differencing */
static void groom_forward_diff_array(
double q[4][3],

```