home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / diverses / leda / incl / subdivis.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  2.1 KB  |  90 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  2.1.1                                                 11-15-1991
  4. +
  5. +
  6. +  subdivision.h
  7. +
  8. +
  9. +  Copyright (c) 1991  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15.  
  16.  
  17. #ifndef SUBDIVISIONH
  18. #define SUBDIVISIONH
  19.  
  20. // We use plane sweep & persistent dictionary
  21.  
  22. #include <LEDA/plane.h>
  23. #include <LEDA/plane_alg.h>
  24. #include <LEDA/planar_map.h>
  25. #include <LEDA/p_dictionary.h>
  26. #include <LEDA/sortseq.h>
  27.  
  28. int compare(segment& s1, segment& s2);
  29.  
  30. declare2(p_dictionary,segment,face)
  31. typedef p_dictionary(segment,face) strip;
  32.  
  33. declare2(sortseq,real,strip)
  34. typedef sortseq(real,strip) strip_list;
  35.  
  36.  
  37. class SubDivision : public planar_map
  38. {
  39.   face outer_face;
  40.   strip_list strips;
  41.   
  42. public:
  43.   
  44.   SubDivision(const graph&);
  45.  
  46.  ~SubDivision() {}
  47.  
  48.   point  position(node v)    const { return point(inf(v)); }
  49.   
  50.   face   locate_point(point) const;
  51.  
  52.   void   print_stripes() const;
  53.   
  54. };
  55.  
  56.  
  57. //------------------------------------------------------------------------------
  58. //
  59. // subdivision(ftype): generic subdivisions with face entries of type "ftype"
  60. //
  61. //------------------------------------------------------------------------------
  62.  
  63. #define subdivision(ftype)   name2(ftype,subdivision)
  64.  
  65. #define subdivisiondeclare(ftype)\
  66. \
  67. class subdivision(ftype) : public SubDivision {\
  68. \
  69. void copy_face_entry(ent& x)  const { x = Copy(*(ftype*)&x); }\
  70. \
  71. void clear_face_entry(ent& x) const { Clear(*(ftype*)&x); }\
  72. \
  73. public:\
  74. \
  75.    ftype  inf(face f)         const { return ftype(SubDivision::inf(f)); }\
  76.    point  operator[](node v)  const { return point(SubDivision::inf(v)); }\
  77.    ftype  operator[](face f)  const { return ftype(SubDivision::inf(f)); }\
  78. \
  79. void print_node(node v) const { cout << "[" << index(v) <<"] (";\
  80.                                 Print(position(v));\
  81.                                 cout << ") ";}\
  82. \
  83.    subdivision(ftype)(GRAPH(point,ftype)& G) : SubDivision((graph&)G)   {}\
  84.   ~subdivision(ftype)()     {}\
  85. \
  86. };
  87.  
  88. #endif SUBDIVISIONH
  89.