أخر الاخبار

Examples Mid Point Circle Drawing Algorithm

 Examples Mid Point Circle Drawing Algorithm 

 

 Ex1//By using Mid Point Circle Algorithm given the center point coordinates (0, 0) and radius as 10, generate all the points to form a circle.

Solution: 

o Given: 

Centre Coordinates of Circle: (X0, Y0) = (0, 0)

 Radius of Circle = 10 

STEP – 01: 

o Assign the starting point coordinates (X0, Y0) as: 

X0 = 0

 Y0 = R = 10

STEP – 02:

 o Calculate the value of initial decision parameter P0 as: 

P0 = 1 – R = 1 – 10 = -9

STEP – 03: 

o As Pinitial < 0, so case-01 is satisfied. Thus,

 Xk+1 = Xk + 1 = 0 + 1 = 1

 Yk+1 = Yk = 10 

Pk+1 = Pk + 2×Xk+1 + 1 = -9 + (2×1) + 1 = -6

STEP – 04: 

o This step is not applicable here as the given centre point coordinates is (0, 0).

STEP – 05:

 o Step-03 is executed similarly until Xk+1 >= Yk+1 as follows:


Ex2//By using Mid Point Circle Algorithm given the center point coordinates (4, -4) and radius as 10, generate all the points to form a circle.

Solution: 

o Given: 

Centre Coordinates of Circle: (X0, Y0) = (4, -4) 

Radius of Circle = 10

As stated in the algorithm, o We first calculate the points assuming the center coordinates is (0, 0). o At the end, we translate the circle.

o Step-01, Step-02 and Step-03 are already completed in Problem-01.

 o Now, we find the values of Xplot and Yplot using the formula given in Step-04 of the main algorithm.

 o The following table shows the generation of points for Quadrant-1:

 Xplot = Xc + X0 = 4 + X0

 Yplot = Yc + Y0 = 4 + Y0



تعليقات



حجم الخط
+
16
-
تباعد السطور
+
2
-