include/del_interface.hpp

Go to the documentation of this file.
00001 
00002 
00092 //-----------------------------------------------------------
00093 
00094 
00095 
00096 
00097 
00107 #ifndef DEL_INTERFACE
00108 #define DEL_INTERFACE
00109 
00110 #include <dpoint.hpp>
00111 #include <vector>
00112 #include <string>
00113 
00115 namespace tpp {
00116 
00117 
00118 
00120 
00126 class Delaunay {
00127 public:
00129 
00132         typedef  reviver::dpoint <double, 2> Point; 
00133 
00134 private:
00135         
00136         std::vector< Point >  PList;
00137         void *in;                                       
00138         void *delclass;                         
00139         void *pmesh;                            
00140         void *pbehavior;
00141         bool Triangulated;
00142 
00143         void Triangulate(std::string& triswitches);
00144 
00145 public:
00147 
00151         Delaunay(std::vector< Point >& v){
00152                 PList.assign(v.begin(), v.end());
00153                 Triangulated = false;
00154         }
00155 
00157 
00161         void Triangulate() { std::string s = "vzQ"; Triangulate( s ); } ;
00162 
00164 
00167         void writeoff(std::string& fname);
00168 
00170 
00174         int nedges();
00175         
00177 
00182         int ntriangles();
00183 
00185 
00190 
00191 
00195         int nvertices();
00196 
00198 
00202         int hull_size();
00203 
00205 
00209         ~Delaunay();
00210 
00212         //
00213         // Vertex Iterator
00214         //
00216 
00218         class vIterator {
00219                 private:
00220                         vIterator(Delaunay *);  
00221                         Delaunay *MyDelaunay;     
00222 
00223                         void *vloop;              
00224 
00225                 public:
00226                         vIterator operator++();
00227                         vIterator():vloop(NULL) {};
00228                         Point &operator*() const; 
00229                         ~vIterator();
00230 
00231                 friend class Delaunay;
00232                 friend bool operator==(vIterator const &, vIterator const &);
00233                 friend bool operator!=(vIterator const &, vIterator const &);
00234         };
00235         
00237     vIterator vbegin(){ return vIterator(this);} ;
00239         vIterator vend();
00240 
00242         int vertexId(vIterator const &);
00243 
00245         const Point& point_at_vertex_id(int i) {return PList[i];};
00246 
00247 
00248         friend class vIterator; 
00249 
00250 
00252         //
00253         // Face Iterator
00254         //
00256 
00258         class fIterator {
00259                 private:
00260 
00261                                         struct tdata {
00262                                                 double ***tri;
00263                                                 int orient;
00264                                         };
00265 
00266                                         typedef struct tdata  poface;
00267 
00268                         fIterator(Delaunay *);  
00269                         Delaunay *MyDelaunay;     
00270 
00271                         //void *floop;              //! Triangles Internal data.
00272                                                 poface floop;
00273                                                 
00274                 public:
00275                         void operator++();
00276                                                 fIterator() {floop.tri = NULL;};
00277                                     ~fIterator();
00278 
00279                 friend class Delaunay;
00280                 friend bool operator==(fIterator const &, fIterator const &);
00281                 friend bool operator!=(fIterator const &, fIterator const &);
00282         };
00283 
00285         fIterator fbegin(){ return fIterator(this);     } ;
00287         fIterator fend();
00288         int faceId(fIterator const &);
00289 
00290 
00292 
00301         int Org (fIterator const & fit);
00302 
00304 
00314         int Dest(fIterator const & fit);
00315 
00317 
00327         int Apex(fIterator const & fit);
00328 
00329 
00331 
00349         int Sym(fIterator const & fit, char i);
00350 
00351 
00353 
00366         fIterator Sym(fIterator const & fit);
00367 
00368 
00370 
00375         inline bool empty(fIterator const & fit)
00376                 { return fit.floop.tri == NULL; };
00377 
00379 
00384         bool isdummy(fIterator const & fit);
00385 
00386 
00387      
00389 
00397         fIterator Lnext(fIterator const & fit);
00398 
00400 
00408         fIterator Lprev(fIterator const & fit);
00409 
00411 
00419         fIterator Onext(fIterator const & fit);
00420 
00421         
00423 
00431         fIterator Oprev(fIterator const & fit);
00432 
00433 
00434 // TODO List: (for face iterators)
00435 /*  dnext:  Find the next edge counterclockwise with the same destination.   */
00436 /*  dnext(abc) -> *ba                                                        */
00437 /*                                                                           */
00438 /*  dprev:  Find the next edge clockwise with the same destination.          */
00439 /*  dprev(abc) -> cb*                                                        */
00440 /*                                                                           */
00441 /*  rnext:  Find the next edge (counterclockwise) of the adjacent triangle.  */
00442 /*  rnext(abc) -> *a*                                                        */
00443 /*                                                                           */
00444 /*  rprev:  Find the previous edge (clockwise) of the adjacent triangle.     */
00445 /*  rprev(abc) -> b**                                                        */
00446 
00447 
00448 
00450 
00460         void trianglesAroundVertex(int vertexid, std::vector<int>& ivv );
00461 
00463 
00469         double area(fIterator const & fit);
00470 
00471 
00472 
00474 
00479         fIterator locate(int vertexid);
00480 
00481 
00482 
00483     friend class fIterator;
00484 
00485 
00486 }; // Class delaunay
00487 
00488 } // namespace tpp ends.
00489 
00490 #endif
00491 
00492 

Generated on Fri Nov 3 21:59:02 2006 for Triangle++ by  doxygen 1.4.6