home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_08 / 8n08058a < prev    next >
Text File  |  1990-07-18  |  673b  |  35 lines

  1.  
  2. Listing 2
  3.  
  4. poly(nverts, poly_list)
  5. int nverts, *poly_list[];
  6. {
  7.   int i;
  8.   
  9.   /* 
  10.     see if vertices list is closed
  11.     and close it if not 
  12.   */
  13.   if (poly_list[0] != poly_list[(nverts*2)-2] ||
  14.       poly_list[1] != poly_list[(nverts*2)-1])
  15.     {
  16.       poly_list[(nverts*2)+0] = poly_list[0];
  17.       poly_list[(nverts*2)+1] = poly_list[1];
  18.       nverts++;
  19.     }
  20.   
  21.   /* 
  22.     invert the Y axis of each vertice in list 
  23.   */
  24.   for (i=0; i < nverts; i++)
  25.     poly_list[(i * 2)+1] = ydots-poly_list[(i * 2)+1];
  26.   
  27.   /* 
  28.     then draw it 
  29.   */
  30.   if (filling)
  31.     fill_polygon_a(nverts,poly_list);
  32.   else
  33.     draw_polyline(nverts,poly_list);
  34. }
  35.