Page 56 - DCAP504_Computer Graphics
P. 56

Unit 4: Scan Conversion I



               Therefore,
               ΔS = dnew - dold = a2 (-2Yp +3)
               To move SE,
               dnew = f (Xp + 3/2, Yp – 2) = b2 (Xp +3/2)2 +a2 (Yp – 2)2 - a2b2

               Therefore,
               ΔSE = dnew - dold = b2 (2Xp + 2) + a2 (-2Yp + 3)
               We must now compute the initial value of d, i.e. dstart. Let us start drawing at (0, b).
               Then the first midpoint is (1, b - 1/2). Therefore,
               f (1, b - 1/2) = b2 + a2 (b -1/2)2 +a2b2 = b2 + a2 (- b + 1/4)
               During each of the iterations in the upper region, we must not only test the decision variable d and
               update the Δ functions, but  also test switching regions by evaluating the gradient at the midpoint
               between E and SE. When we cross over to region 2 (lower region), we change our choice of two pixels to
               compare from E, SE to S, SE. At the same time, we change the value of our decision variable to d for
               region 2. If the last pixel chosen in region 1 is located at (Xp, Yp), then d is once again initialized at (Xp
               + ½, Yp - 1). We stop drawing when the Y-value becomes 0.
               4.5   Arcs and Sectors

               An arc is a part of the circumference of a circle as shown in figure 4.8 (a). Mathematically an arc can be
               generated using either the polynomial or trigonometric method. In the trigonometric method, the arc is
               generated using two angles. As shown in figure 4.8 (b), two angles θ1 and θ2 are used to generate the
               arc where, θ1 marks the beginning of the arc and θ2 marks the end of the arc. With the help of these two
               values an arc can be easily constructed.

                           Since the arc is a part of the circumference of a circle. Hence, along with the two angles
                           the important component that has to be taken into account is the radius of the
                           circumference, i.e. distance between any point on the  circumference and origin.
                           Therefore, it is very important to consider all the three elements θ 1, θ 2, and radius while
                           constructing the arc.
               Both figures 4.8 (a) and (b) bring out the distinct relationship between the arc and circle. It also depicts
               how the angles θ1 and θ2 used to generate an arc. The rest of the steps that are followed to generate the
               arc are similar to those used for scan converting a circle, except  that symmetry is not used. (Refer
               section 4.3 for scan converting a circle.)

               Figure 4.8 illustrates an arc.

                                            Figure 4.8: Illustration of an Arc



















               Source: Computer Graphics, II edition, ZHIGANG ZIANG, ROY PLASTOCK, SCHAUMS OUTLINES, Chapter 3



                                        LOVELY PROFESSIONAL UNIVERSITY                           49
   51   52   53   54   55   56   57   58   59   60   61