Bezier Curve

 
notion image

Mathematical

A Bezier curve is a parametric equation about the points that represent a curve. We specify within the equation:
0t10 \leqslant t \leqslant 1
As the parameter t growth, we can get the point coordinates on any curve.
If the curve only have two control points, then this will be a straight line:
f(x)=(1t)p0+tp1f(x) = (1-t)p_0 + tp_1
If the curve is quadratic, we will have three control points, whose derivative is first, and the second derivative is constant, which means that it can only have one kind of concavity and convexity, and the rate of change of curvature will not be too large:
f(x)=(1t)2p0+(t1)tp1+t2p2f(x) = (1-t)^2p_0 + (t-1)tp_1+t^2p_2
If the curve is cubic, we will have four control points, the derivative of which is quadratic, and the second derivative is once, and its bumpiness may change, which is our most commonly used Bezier curve:
f(x)=(1t)3p0+(t1)2tp1+(t1)t2p2+t3p3f(x) = (1-t)^3p_0 + (t-1)^2tp_1+(t-1)t^2p_2 + t^3p_3

Implementation

By setting the points on the screen as control points and splitting the line segment into many straight line segments, we can easily draw Bezier curves.
You can drag any red control points to observe it.