home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ledar34.zip / leda-r-3_4_tar / LEDA-3.4 / src / plane_alg / misc.c < prev    next >
Text File  |  1996-09-03  |  1KB  |  44 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA 3.4
  4. +
  5. +  misc.c
  6. +
  7. +  This file is part of the LEDA research version (LEDA-R) that can be 
  8. +  used free of charge in academic research and teaching. Any commercial
  9. +  use of this software requires a license which is distributed by the
  10. +  LEDA Software GmbH, Postfach 151101, 66041 Saarbruecken, FRG
  11. +  (fax +49 681 31104).
  12. +
  13. +  Copyright (c) 1991-1996  by  Max-Planck-Institut fuer Informatik
  14. +  Im Stadtwald, 66123 Saarbruecken, Germany     
  15. +  All rights reserved.
  16. *******************************************************************************/
  17.  
  18. bool Is_Simple_Polygon(const list<POINT>& L)
  19. {
  20.   list<SEGMENT> seg_list; 
  21.  
  22.   list_item it;
  23.   forall_items(it,L)
  24.   { POINT p = L[it];
  25.     POINT q = L[L.cyclic_succ(it)];
  26.     seg_list.append(SEGMENT(p,q));
  27.    }
  28.  
  29.   GRAPH<POINT,SEGMENT> G;
  30.  
  31.   SWEEP_SEGMENTS(seg_list,G);
  32.  
  33.   node v;
  34.   forall_nodes(v,G)
  35.     if (G.degree(v) != 2) return false;
  36.  
  37.   return true;
  38.  
  39. }
  40.  
  41.  
  42.  
  43.