Bezier curve definition Bezier curve, also known as Bezier curve or Bezier curve, is a mathematical curve used in two-dimensional graphics applications. General vector graphics software uses it to accurately draw a curve. A Bates curve consists of line segments and nodes, which are draggable fulcrum points, and line segments that are like stretchable rubber bands. The pen tool we see on the drawing tool is used to do this vector curve. Bessel curve is an important parameter curve in computer graphics. Bessel curve tools are also available in some mature bitmap software, such as PhotoShop. There is no complete curve tool in Flash4, and bezier curve tool is available in Flash5. The Bezier curve was widely published in 1962 by French engineer Pierre Bezier, who used it to design the body of a car. Bessel curve was first developed by Paul de Casteljau in 1959 using de Casteljau algorithm to obtain Bates curve with stable numerical method.


First order Bezier curve

Given points P0, P1, the linear Bates curve is just a straight line between two points. The line is given by the following formula:






Second order Bezier curve formula






Draw a second-order Bezier curve using Path

MPath. MoveTo (300, 500); // Draw the second order Bessel curve mPath. MoveTo (300, 500); MPath. QuadTo (500100800500); canvas.drawPath(mPath, mPaint);Copy the code

MoveTo moves to the starting point of the action. It does not draw and is only used to move the brush

QuadTo (x1,y1, x2,y2) generates a second-order Bessel curve with (x1,y1) as the control point and (x2,y2) as the end point



Third order Bezier curve formula

// Draw the third order Bessel curve mPath. MoveTo (300, 500); mPath.cubicTo(500, 100, 600, 1200, 800, 500); canvas.drawPath(mPath, mPaint);Copy the code