]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
For convenience, provide bezier curve functions globally.
authorRudolf Polzer <divverent@xonotic.org>
Sat, 1 Mar 2014 11:32:37 +0000 (12:32 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 1 Mar 2014 11:32:37 +0000 (12:32 +0100)
qcsrc/common/util.qc
qcsrc/common/util.qh

index bdf80e5d1cb92f698d3944743f7d4a5375258570..c50a3ba5350d3b1fd1bdb394bc0b3ca5852026dd 100644 (file)
@@ -2789,3 +2789,18 @@ float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents)
        return CONTENT_EMPTY;
 }
 #endif
+
+vector bezier_quadratic_getpoint(vector a, vector b, vector c, float t)
+{
+       return
+               (c - 2 * b + a) * (t * t) +
+               (b - a) * (2 * t) +
+               a;
+}
+
+vector bezier_quadratic_getderivative(vector a, vector b, vector c, float t)
+{
+       return
+               (c - 2 * b + a) * (2 * t) +
+               (b - a) * 2;
+}
index 820f4f5db3fe626400502f4dd78656c402a4aa42..503aa2d2a0f9452fa81232493caa94e95383477b 100644 (file)
@@ -441,3 +441,7 @@ float Announcer_PickNumber(float type, float num);
 float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents);
 float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents);
 #endif
+
+// Quadratic splines (bezier)
+vector bezier_quadratic_getpoint(vector a, vector p, vector b, float t);
+vector bezier_quadratic_getderivative(vector a, vector p, vector b, float t);