Page 109 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 109

Unit 6: Implementing Polygon Filling Algorithm



                         putpixel (x+1, y, newclr);                                               Notes
                         insert (x+1, y, &last);
                     }
                        tmp = first;
                        first = first->next;
                        x = first->x;
                        y = first->y;
                        free (tmp);
                    }
                   }
                     void insert (int x, int y, struct Node** last)
                   {
                      struct Node* p;
                      p = (struct Node*) malloc (sizeof (struct Node));
                      if (p == NULL)
                    {
                        closegraph();
                        fprintf (stderr, “\n insert: Out of memory.\n”);
                        exit (2);
                    }
                      p->x = x;
                      p->y = y;
                      p->next = NULL;
                      (*last)->next = p;
                      *last = (*last)->next;
                   }
                          Flood fill algorithm was first available commercially in 1981 on a Vicom Image
                          Processing system manufactured by Vicom Systems.

            Self Assessment Questions

               6.  A polygon consists of a finite number of ……………….. segments.
               7.  The line segment of the polygon is called …………………...
               8.  The ………………. is usually applied to test whether a point is interior or not.
               9.  The point is considered to be …………….. if the number of intersections between the line
                 and the polygon edges is odd.
              10.  Regions which can be completely filled with boundary-fill algorithm are called …………
                 regions.
              11.  A polygon which has a concave portion, the ………………. algorithm will work correctly.

              12.  The scan line fill algorithm is an ingenious way of filling ………….. polygons.
              13.  The scan line algorithm solves the outer edge problem by …………… from outside the
                 image.




                                             LOVELY PROFESSIONAL UNIVERSITY                                   103
   104   105   106   107   108   109   110   111   112   113   114