Draw circle with radians

Source: Internet
Author: User

We know that the angle will not change with the radius. Angle, arc length (or area) and radius are inevitably related.
Because the arc length and radius are numbers. The angle is that the degree conversion is not very convenient. If we can directly represent the relationship F by the arc length and radius, it is more convenient. Therefore, we have the concept of radians.
The unit of radians is recorded as rad. Radians are the arc-length ratio radius, that is, L/R. If l = r, it indicates 1rad.
The circumference of one circle is L = pI * 2 * r. The circumference/R of a circle is a radian, and L/r = 2 * pI * r/r = 2 * pI <=> 360 degrees. therefore, a circle can be expressed either in 360 degrees or in 2 * PI radians. 2 * PI rad.
1rad = 180/PI = 57.3 degrees. 1 degree = PI/180 = 01745rad.
The trigonometric function decodes the relationship between the degree and the two sides.
Use the trigonometric function below to draw a circle.

VaRC = Document. getelementbyid ("mycanvas ");
VaRCxt = C. getcontext ("2D ");
VaRR = 100;

Cxt. moveTo (200,100 );
For(VaRI1 = 0; I1 <= 360; I1 ++)
Cxt. lineto (R + math. Cos (fmath. radian (I1) * R, r-Math.sin (fmath. radian (I1) * R );
Cxt. Stroke ()

Click here to view the source code

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.