Page 102 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 102

Lab on Computer Graphics



                   Notes
                                                         Figure 6.2: A Non-simple Polygon



































                                 The  third  step  accepts  a  sorted  list  of  points  and  connects  them  according  to  the  odd-party
                                 rule. For example, given the list [p 1 ; p 2 ; p 3 ; p 4 … p 2n-1 ; p 2n ], it draws the lines p 1  → p 2 ; p 3  → p 4 ;
                                 …. ; p 2n-1  → p 2n . A decision must be taken as to whether the edges should be displayed or not:
                                 given that p 1 = (x 1 , y) and p 2  = (x 2 , y), should we display the line (x 1 , y, x 2 , y) or just the interior
                                 points (x 1  + 1, y, x 2  – 1, y).


                                 Consider the polygon in Figure 6.2. The edge Table 6.1 for such a polygon would be:

                                                              Table 6.1: Edge Table


                                                                                                  1
                                           Edge       Y min     Y max    X of Y min  X of Y max
                                                                                                 m
                                           E1         11         11         6          11         0
                                           E2          7         11        15          11        –1
                                           E3          3          7        15          15         0
                                           E4          3          3        10          15         –
                                           E5          3          5        10          10         0
                                           E6          5          5        10          6          –
                                           E7          3          5         6          6          0
                                           E8          3          3         3          6          –
                                           E9          3          7         3          3          0
                                           E10         7         11         3          7          1






        96                                LOVELY PROFESSIONAL UNIVERSITY
   97   98   99   100   101   102   103   104   105   106   107