Page 43 - Computer Graphics
P. 43

42

               Initial decision parameter

               In region 1 the initial value of a decision parameter is obtained by giving

               starting position = (0,ry).

                                   2
                                       2
                           2
               i.e. p10=ry +1/4rx -rx ry
               When we enter into a region 2 the initial position is taken as the last position
               selected in region 1 and the initial decision parameter in region 2 is then:

                                                    2
                                             2
                       2
                                 2
                                      2
                                                 2
               p20=ry (x0+1/2) +rx (y0-1) -rx ry


               Algorithm :

                   1.  Take the input and ellipse centre and obtain the first point on an ellipse
                       cantered on the origin as a (x,y 0)= (0,r y).

                   2.  Now calculate the initial decision parameter in region 1 as:
                                      2
                              2
                                          2
                       p10=ry +1/4rx -rx ry
                   3.  At each xk position in region 1 perform the following task. If p1k<0 then
                       the next point along the ellipse centered on (0,0) is (xk+1,yk).
                                        2
                                           2
                                                    2
                       i.e. p1k+1=p1k+ ry xk+1+ry
                       Otherwise the next point along the circle is (x k+1,y k -1)
                                           2
                                                                2
                       i.e. p1k+1=p1k+2ry xk+1 – 2rx yk+1+ry
                                                       2
                   4.  Now, again calculate the initial value in region 2 using the last
                                                                            2
                                                                                                  2
                                                                                           2
                                                                                      2
                       point (x0,y0) calculated in a region 1 as : p20=ry (x0+1/2) +rx (y0-1) -
                         2
                            2
                       rx ry
                   5.  At each yk position in region 2 starting at k =0 perform the following
                       task. If p2k<0 the next point along the ellipse centered on (0,0) is (xk , yk-
                       1)
                                                    2
                                           2
                       i.e. p2k+1=p2k-2rx yk+1+rx
                       Otherwise the next point along the circle will be (xk+1,yk -1)
                                                               2
                       i.e. p2k+1 =p2k+2ry xk+1 -2rx yk+1+rx
                                            2
                                                      2
                   6.  Now determine the symmetric points in another three quadrants.
                   7.  Plot the coordinate value as: x=x+xc , y=y+yc

                                                                 2
                                                                          2
                   8.  Repeat the steps for region 1 until 2ry x>=2rx y.
   38   39   40   41   42   43   44   45   46   47   48