Three times the Bezier curve to draw the circle method.

Source: Internet
Author: User

The previous article on The Imitation 58 Loadingview of the same city, there is a Bezier curve to draw a circle, the Bezier curve theory is very complex, I would like to talk about what is known and can be used.
For example, in the previous Loadingview project, to use Path.cubic () to draw a circle with a Bezier curve, the first thing to know is
Definition of the Path.cubic () method:

void cubicTo(float x1,float y1,float x2,float y2,float x3,floatfrom the last point,approaching control points(x1,y1)and(x2,y2),and ending at (x3,y3)

What do you mean, from our last point of departure to close (X1,y1) (X2,y2) The direction of the two points to go to the end at (x3,y3) point.
What do you mean close? For example, y = 1/x^3 the trajectory of this function when x approaches 0 o'clock, the trajectory infinitely approaching the y-axis value tends to infinity.

Such a trajectory is presented when the curve progresses from 0 to a point approaching 1 points and ends at 4 o'clock.
So when you want to draw a circle with a three-time equation Bezier curve, the method in the project is to draw 4 1/4 circles, and it takes 1/4 points to draw the four circle with three times a time.
In this picture (0,0) is our starting point (the first) is the end of the two points are on the circle can know the coordinates, so to calculate (x1,0) (1,y1) The coordinates of the two points.

这就是magicNumber的由来。

We connect the center of the Circle with (x1,0) (0,0) and the angle of the two lines is 20°, which calculates the coordinates of the X1. Similarly y1, this coordinate value is magicnumber.
You can draw a circle by counting the coordinates of four points.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Three times the Bezier curve to draw the circle method.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.