Skip to content

Commit 7cf26ac

Browse files
committed
bezierQuadratic
1 parent b07a190 commit 7cf26ac

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dlib/math/interpolation/bezier.d

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ module dlib.math.interpolation.bezier;
3838
import dlib.math.vector;
3939

4040
/**
41-
* Computes cubic Bézier curve
41+
* Computes quadratic Bézier curve
42+
*/
43+
T bezierQuadratic(T)(T A, T B, T C, T t)
44+
{
45+
T s = cast(T)1.0 - t;
46+
return s * s * A + 2.0 * s * B + t * t * C;
47+
}
48+
49+
/**
50+
* Computes cubic Bézier curve
4251
*/
4352
T bezierCubic(T) (T A, T B, T C, T D, T t)
4453
{

0 commit comments

Comments
 (0)