After learning how to draw line using certain algorithms , we will proceed to the Circle Drawing algorithms , as it is a frequently used component in the pictures and graphs. Full circle or circular arcs is used in most graphic packages.
Let us first understand the properties of the circle.
Properties of circles:-
The center-radius form of the circle equation is (x – h)2 + (y – k)2 = r2, with the center being at the point (h, k) and the radius being “r“. This form of the equation is helpful, since you can easily find the center and the radius.The distance is expressed by the Pythagorean Theorem which is expressed as
We can use this equation to calculate the position of points by stepping along the x axis in unit steps from xc -r and xc +r.
Y = yc ± ( r2 – (xc – x)2 ) 1/2
Also, the problem is that it involves a considerable amount of calculation So, we can reduce this equation where it involves simple addition calculation for half semicircle.
The equation is :-
X = xc + rcosα
Y = yc + rsinα
The r and α are polar coordinates.