Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-07-11 08:28:39 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-07-11 10:16:35 +0300
commitb32408eff896307741498bee4ec5dacb5b6953ee (patch)
treed7518b470b1841d47d559642ce2d1af26fb99d97 /source/blender/blenlib/intern/math_vector.c
parente41abdb9076f351acb01bf73900e821334850b06 (diff)
BLI_math: move interp_*_cubic to its own function
Diffstat (limited to 'source/blender/blenlib/intern/math_vector.c')
-rw-r--r--source/blender/blenlib/intern/math_vector.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 988034349e0..95d5c9fde87 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -164,6 +164,27 @@ void interp_v2_v2v2_slerp_safe(float target[2], const float a[2], const float b[
}
}
+/** \name Cubic curve interpolation (bezier spline).
+ * \{ */
+
+void interp_v2_v2v2v2v2_cubic(
+ float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2],
+ const float u)
+{
+ float q0[2], q1[2], q2[2], r0[2], r1[2];
+
+ interp_v2_v2v2(q0, v1, v2, u);
+ interp_v2_v2v2(q1, v2, v3, u);
+ interp_v2_v2v2(q2, v3, v4, u);
+
+ interp_v2_v2v2(r0, q0, q1, u);
+ interp_v2_v2v2(r1, q1, q2, u);
+
+ interp_v2_v2v2(p, r0, r1, u);
+}
+
+/** \} */
+
/* weight 3 vectors,
* 'w' must be unit length but is not a vector, just 3 weights */
void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3])