voronoi2dimpl< C, V > Class Template Reference

#include <voronoi2dimpl.hpp>

List of all members.

Public Types

Public Member Functions

Public Attributes

Protected Member Functions


Detailed Description

template<class C, class V = default_env>
class mmx::shape::voronoi2dimpl< C, V >

Definition at line 41 of file voronoi2dimpl.hpp.


Member Typedef Documentation

Definition at line 51 of file voronoi2dimpl.hpp.

Definition at line 52 of file voronoi2dimpl.hpp.

typedef mesher2d<C,V>::Cell2d Cell2d

Definition at line 53 of file voronoi2dimpl.hpp.

typedef mesher2d<C,V>::Curve Curve

Definition at line 54 of file voronoi2dimpl.hpp.

Definition at line 49 of file voronoi2dimpl.hpp.

Definition at line 50 of file voronoi2dimpl.hpp.

typedef kdtree<Cell*> Kdtree

Definition at line 57 of file voronoi2dimpl.hpp.

typedef node<Cell*> Node

Definition at line 56 of file voronoi2dimpl.hpp.

Definition at line 48 of file voronoi2dimpl.hpp.

typedef topology<C,typename use<ref_def,double, V >::Ref> Topology

Definition at line 46 of file voronoi2dimpl.hpp.


Constructor & Destructor Documentation

voronoi2dimpl ( const BoundingBox bx  )  [inline]

Definition at line 61 of file voronoi2dimpl.hpp.

00061 : m_maxprec(0.1), m_minprec(0.01), m_bbx(bx) { };

voronoi2dimpl ( Curve curve  ) 
~voronoi2dimpl ( void   )  [inline]

Definition at line 64 of file voronoi2dimpl.hpp.

00064 {};//   delete this->m_tree ;  };


Member Function Documentation

bool insert_regular ( Cell bcell  )  [inline, protected]

Definition at line 81 of file voronoi2dimpl.hpp.

References Cell2dVoronoiImpl2d, Cell3d, EPSILON, bcell2d< C, V >::intersections(), voronoi2dimpl< C, V >::m_graph, voronoi2dimpl< C, V >::m_objects, Graph< T >::push_uedge(), Graph< T >::push_vertex(), Seq< C, R >::size(), and VCell.

Referenced by voronoi2dimpl< C, V >::run().

00082     { 
00083       //return bcell->insert_regular(this);
00084 
00085   Seq<Point*> l;
00086     l= ((VCell*)bcell)->intersections();
00087 
00088   int * sz;
00089   int * st;
00090   Point *q;
00091 
00092   if ( l.size()==2 )
00093   {
00094     this->m_graph.push_vertex(l[0]);
00095     this->m_graph.push_vertex(l[1]);
00096     this->m_graph.push_uedge(l[0],l[1]);
00097 
00098     return true;
00099   }
00100 
00101   if ( l.size()==4 ) // two dublicated
00102   {
00103     this->m_graph.push_vertex(l[0]);
00104     this->m_graph.push_vertex(l[1]);
00105     this->m_graph.push_uedge(l[0],l[1]);
00106     return true;
00107   }
00108   
00109   if ( l.size()==1)
00110   {
00111     std::cout<< "SIZE ONE, "<< *bcell<<std::endl;
00112 
00113     this->m_graph.push_vertex(l[0]);
00114 
00115     foreach( Cell3d* c, ((VCell*)bcell)->m_objects )
00116       if ( ((Cell2d*)c)->nb_intersect()==1 )
00117       {
00118         sz= ((Cell2dVoronoiImpl2d*)c)->m_polynomial.rep().szs();
00119         st= ((Cell2dVoronoiImpl2d*)c)->m_polynomial.rep().str();
00120         if ( ((Cell2dVoronoiImpl2d*)c)->m_polynomial[0]<EPSILON )
00121         {
00122           q= new Point(bcell->xmin(),bcell->ymin(),0); 
00123 //          std::cout<< "1.add ("<< *q <<")->("<< *l[0] << ") in "<< *this<<std::endl;
00124 
00125           this->m_graph.push_vertex(q);
00126           this->m_graph.push_uedge(l[0],q);
00127 
00128           ((Cell2dVoronoiImpl2d*)c)->n_intersections<< q;
00129 
00130           foreach( Cell2d *nb, ((Cell2d*)bcell)->s_neighbors )
00131             foreach( Cell3d* cc, ((VCell*)nb)->m_objects )
00132             if ( cc->is_active() )
00133             {
00134               ((Cell2dVoronoiImpl2d*)cc)->n_intersections<< q;
00135               std::cout<<"This Intersections: "<< ((VCell*)bcell)->intersections().size() << std::endl;
00136               std::cout<<"Neib Intersections: "<< nb->intersections().size() << std::endl;
00137               return true;
00138             }
00139           foreach( Cell2d *nb, ((Cell2d*)bcell)->w_neighbors )
00140             foreach( Cell3d* cc, ((VCell*)nb)->m_objects )
00141             if ( cc->is_active() )
00142             {
00143               ((Cell2dVoronoiImpl2d*)cc)->e_intersections<< q;
00144               std::cout<<"This Intersections: "<< ((VCell*)bcell)->intersections().size() << std::endl;
00145               std::cout<<"Neib Intersections: "<< nb->intersections().size() << std::endl;
00146               return true;
00147             }
00148 
00149         } else if ( ((Cell2dVoronoiImpl2d*)c)->m_polynomial[(sz[0]-1)*st[0]]<EPSILON )
00150         {
00151           q= new Point(bcell->xmax(),bcell->ymax(),0);
00152           std::cout<< "2.add ("<< *q <<")->("<< *l[0] << ") in "<< *bcell<<std::endl;
00153 
00154           this->m_graph.push_vertex(q);
00155           this->m_graph.push_uedge(l[0],q);
00156           ((Cell2dVoronoiImpl2d*)c)->s_intersections<< q;
00157 
00158 
00159           foreach( Cell2d *nb, ((VCell*)bcell)->e_neighbors )
00160             foreach( Cell3d* cc, ((VCell*)nb)->m_objects )
00161             if ( cc->is_active() )
00162             {
00163               ((Cell2dVoronoiImpl2d*)cc)->w_intersections<< q;
00164               std::cout<<"This Intersections: "<< ((VCell*)bcell)->intersections().size() << std::endl;
00165               std::cout<<"Neib Intersections: "<< nb->intersections().size() << std::endl;
00166               return true;
00167             }
00168           foreach( Cell2d *nb, ((VCell*)bcell)->n_neighbors )
00169             foreach( Cell3d* cc, ((VCell*)nb)->m_objects )
00170             if ( cc->is_active() )
00171             {
00172               ((Cell2dVoronoiImpl2d*)cc)->s_intersections<< q;
00173               std::cout<<"This Intersections: "<< ((VCell*)bcell)->intersections().size() << std::endl;
00174               std::cout<<"Neib Intersections: "<< nb->intersections().size() << std::endl;
00175               return true;
00176             }
00177 
00178         } else if ( ((Cell2dVoronoiImpl2d*)c)->m_polynomial[sz[0]*sz[1]-1]<EPSILON )
00179         {
00180           q= new Point(bcell->xmin(),bcell->ymax(),0);
00181 //          std::cout<< "3.add ("<< *q <<")->("<< *l[0] << ") in "<< *this<<std::endl;
00182           this->m_graph.push_vertex(q);
00183           this->m_graph.push_uedge(l[0],q);
00184 
00185           ((Cell2dVoronoiImpl2d*)c)->w_intersections<< q;
00186           return true;
00187         } else if ( ((Cell2dVoronoiImpl2d*)c)->m_polynomial[(sz[1]-1)*st[1]]<EPSILON )
00188         {
00189           q= new Point(bcell->xmax(),bcell->ymin(),0);
00190 //          std::cout<< "4.add ("<< *q <<")->("<< *l[0] << ") in "<< *this<<std::endl;
00191           this->m_graph.push_vertex(q);
00192           this->m_graph.push_uedge(l[0],q);
00193           ((Cell2dVoronoiImpl2d*)c)->e_intersections<< q;
00194           return true;
00195         }  
00196       }
00197   }
00198 
00199   if ( l.size()==0)
00200   {
00201     std::cout<< "SIZE ZERO, "<< *bcell<<std::endl;
00202     return true;
00203 
00204     foreach( Cell3d* c, ((VCell*)bcell)->m_objects )
00205       {
00206         sz= ((Cell2dVoronoiImpl2d*)c)->m_polynomial.rep().szs();
00207         st= ((Cell2dVoronoiImpl2d*)c)->m_polynomial.rep().str();
00208         if ( ((Cell2dVoronoiImpl2d*)c)->m_polynomial[0]<EPSILON )
00209         {
00210           q= new Point(bcell->xmin(),bcell->ymin(),0); 
00211           std::cout<< "1.add ("<< *q <<") in "<< *bcell<<std::endl;
00212           this->m_graph.push_vertex(q);
00213           ((Cell2dVoronoiImpl2d*)c)->n_intersections<< q;
00214           return true;
00215         } else if ( ((Cell2dVoronoiImpl2d*)c)->m_polynomial[(sz[0]-1)*st[0]]<EPSILON )
00216         {
00217           q= new Point(bcell->xmax(),bcell->ymax(),0);
00218           std::cout<< "1.add ("<< *q <<") in "<< *bcell<<std::endl;
00219           this->m_graph.push_vertex(q);
00220           ((Cell2dVoronoiImpl2d*)c)->s_intersections<< q;
00221           return true;
00222         } else if ( ((Cell2dVoronoiImpl2d*)c)->m_polynomial[sz[0]*sz[1]-1]<EPSILON )
00223         {
00224           q= new Point(bcell->xmin(),bcell->ymax(),0);
00225           std::cout<< "1.add ("<< *q <<") in "<< *bcell<<std::endl;
00226           this->m_graph.push_uedge(l[0],q);
00227           ((Cell2dVoronoiImpl2d*)c)->w_intersections<< q;
00228           return true;
00229         } else if ( ((Cell2dVoronoiImpl2d*)c)->m_polynomial[(sz[1]-1)*st[1]]<EPSILON )
00230         {
00231           q= new Point(bcell->xmax(),bcell->ymin(),0);
00232           std::cout<< "1.add ("<< *q <<") in "<< *bcell<<std::endl;
00233           this->m_graph.push_vertex(q);
00234           this->m_graph.push_uedge(l[0],q);
00235           ((Cell2dVoronoiImpl2d*)c)->e_intersections<< q;
00236           return true;
00237         }  
00238       }
00239   }
00240 
00241 //    std::cout<< "nb_in= "<<  ((VCell*)bcell)->nb_intersect() <<std::endl;
00242     //std::cout<< "box  = "<< *this <<std::endl;
00243         //foreach(Point* q, this->intersections() ) 
00244         //std::cout<< " "<< *q <<std::endl;
00245 //    print((Cell2dAlgebraicCurve*)m_objects[0]);
00246     return true;
00247 
00248     };

bool is_regular ( Cell bcell  )  [inline, protected]

Definition at line 75 of file voronoi2dimpl.hpp.

References cell< C, V >::is_regular().

Referenced by voronoi2dimpl< C, V >::run().

00076     { 
00077       return bcell->is_regular();
00078       //return mesher2d<C,V>::is_regular(bcell); 
00079     };

void push_back ( voronoi_site2d< C, V > *  v  )  [inline]

Definition at line 284 of file voronoi2dimpl.hpp.

References voronoi2dimpl< C, V >::m_objects, voronoi2dimpl< C, V >::m_sites, and Seq< C, R >::push_back().

00285 {
00286   this->m_objects.push_back(v); 
00287   this->m_sites.push_back(v);
00288 
00289   //std::cout<<"added "<< v->coordinates() << std::endl;
00290 }

void run ( void   )  [inline]

Definition at line 301 of file voronoi2dimpl.hpp.

References assert, gNode< T >::aux(), voronoi2dimpl< C, V >::b_leaves, Cell2dVoronoiImpl2d, GraphDfsIter< T >::currentItem(), Graph< T >::delete_vertex(), Graph< T >::dfs(), bcell2d< C, V >::e_neighbors, GraphDfsIter< T >::first(), gNode< T >::get_data(), face< C, V, POINT >::insert(), voronoi2dimpl< C, V >::insert_regular(), bcell2d< C, V >::intersections(), cell< C, V >::is_active(), bcell2d< C, V >::is_border(), bcell2d< C, V >::is_corner(), voronoi2dimpl< C, V >::is_regular(), GraphDfsIter< T >::isDone(), mmx::ssi::left(), voronoi2dimpl< C, V >::m_bbx, voronoi2dimpl< C, V >::m_faces, bcell2d< C, V >::m_gnode, voronoi2dimpl< C, V >::m_leaves, voronoi2dimpl< C, V >::m_maxprec, voronoi2dimpl< C, V >::m_minprec, voronoi2dimpl< C, V >::m_objects, voronoi2dimpl< C, V >::m_singular_cells, Graph< T >::member(), bcell2d< C, V >::n_neighbors, bcell2d< C, V >::neighbors(), Graph< T >::next(), GraphDfsIter< T >::next(), bcell2d< C, V >::pair(), Graph< T >::push_edge(), Graph< T >::push_vertex(), mmx::ssi::right(), bcell2d< C, V >::s_neighbors, face< C, V, POINT >::set_index(), bounding_box< C, V >::set_zmax(), bounding_box< C, V >::set_zmin(), sgn(), bounding_box< C, V >::size(), Seq< C, R >::size(), bcell2d< C, V >::starting_point(), bcell< C, V >::subdivide(), VCell, VSite, and bcell2d< C, V >::w_neighbors.

00301           {
00302      // assume this->m_sites.size()>1
00303      //mesher2d<C,V>::run();
00304      //std::cout<<"Topology run OK." <<std::endl;
00305 
00307 
00308   std::cout<<"Running, objs="<<this->m_objects.size() << std::endl;
00309 
00310   //Cell* cl = Cell2dFactory::instance()->create(this->m_objects,this->m_bbx);
00311   VCell * l = new VCell(this->m_bbx);
00312   BoundingBox bx= this->m_bbx;
00313   foreach( VSite * vcurve, this->m_objects) 
00314   {
00315     //VoronoiSite2d * vcurve = dynamic_cast<VoronoiSite2d *>(o);
00316     this->m_bbx.set_zmin(0);
00317     bx.set_zmax(1);
00318 
00319     l->push_back( new Cell2dVoronoiImpl2d(vcurve,this->m_bbx) );
00320   }
00321 
00322 //   double maxsz = this->m_maxprec* this->size();
00323 //   double minsz = this->m_minprec* this->size();
00324   double maxsz = this->m_maxprec;
00325   double minsz = this->m_minprec;
00326 
00327   
00328   std::stack<Cell *> bcell_stack;
00329   bcell_stack.push(l);
00330 
00331   while(!bcell_stack.empty()  ) {   //  
00332 
00333 //    Node * node = this->m_nodes.front() ;
00334     Cell   * cl = bcell_stack.top();
00335     bcell_stack.pop();
00336     Cell2d * cl2= dynamic_cast<Cell2d*>(cl);
00337 
00338     //std::cout<<"node "<<cl <<std::endl;
00339 
00340     if(cl->is_active()) {
00341 
00342       //std::cout<<"active.. "<<std::endl;
00343 
00344       if(cl->size() > maxsz) 
00345         { 
00346           //this->subdivide(cl, node) ;
00347           Cell * left, * right;
00348             ((bcell<C,V> *)cl)->subdivide(left, right) ;
00349           bcell_stack.push(left);
00350           bcell_stack.push(right);
00351         }
00352       else if(this->is_regular(cl) )// && cl->is_intersected())
00353       { 
00354         //std::cout<<"ins regular "<<std::endl;
00355         this->insert_regular(cl) ;
00356         //std::cout<<"ok "<<std::endl;
00357         cl2->m_gnode= 
00358           this->m_leaves.push_vertex(cl2);
00359         if (  cl2->is_border() )
00360           this->b_leaves.push_vertex(cl2);       
00361       }
00362       else if(cl->size() > minsz)
00363       { 
00364         //std::cout<<"subdivide "<<std::endl;
00365           Cell* left, * right;
00366           cl->subdivide(left, right) ;
00367           bcell_stack.push(left);
00368           bcell_stack.push(right);
00369       }
00370       else
00371       { 
00372         //std::cout<<"singularity "<<std::endl;
00373         //this->singularity(cl) ;
00374 //        std::cout<<"VD, Inserting singular"<<*cl2<<std::endl;  
00375         this->m_singular_cells<< (VCell*)cl2; // does not work with forwa
00376         ( (VCell*)cl2 )->process_singular() ;
00377 
00378         cl2->m_gnode= 
00379           this->m_leaves.push_vertex(cl2);
00380         if (  cl2->is_border() )
00381           this->b_leaves.push_vertex(cl2);       
00382       }
00383         }
00384     else    //inactive leaf -- end if
00385     {
00386         if (  cl2->is_border() )
00387             this->b_leaves.push_vertex(cl2);       
00388     }
00389   }
00390 
00391   /* add edges */
00392 
00393   // Border graph
00394   //this->b_leaves.dfs(nlist);
00395   GraphDfsIter<Cell2d*> dfs(b_leaves);
00396   Cell2d* cl2= NULL;
00397 
00398   //foreach(Cell2d* cl2, nlist)
00399   for (dfs.first(); !dfs.isDone(); dfs.next() )
00400   {
00401     cl2= dfs.currentItem()->get_data();
00402     //std::cout<< *cl2 <<"\n";
00403 
00404     if (cl2->s_neighbors.size()==0)
00405       foreach(Cell2d* nb, cl2->e_neighbors )
00406         if ( this->b_leaves.member(nb) && nb->s_neighbors.size()==0)
00407           this->b_leaves.push_edge( cl2,nb ) ;
00408     if (cl2->e_neighbors.size()==0)
00409       foreach(Cell2d* nb, cl2->n_neighbors )
00410         if (this->b_leaves.member(nb) && nb->e_neighbors.size()==0)
00411           this->b_leaves.push_edge( cl2,nb ) ;
00412     if (cl2->n_neighbors.size()==0)
00413       foreach(Cell2d* nb, cl2->w_neighbors )
00414         if (this->b_leaves.member(nb)&& nb->n_neighbors.size()==0)
00415           this->b_leaves.push_edge( cl2,nb ) ;
00416     if (cl2->w_neighbors.size()==0)
00417              foreach(Cell2d* nb, cl2->s_neighbors )
00418                if (this->b_leaves.member(nb)&& nb->w_neighbors.size()==0)
00419                  this->b_leaves.push_edge( cl2,nb ) ;
00420   }
00421   //nlist.clear();
00422 
00424 
00425      // Treating singular bcells
00426      foreach( VCell* q, m_singular_cells )
00427      { 
00428 
00429        std::cout<<"NEED boundary \n";
00430        //q->compute_boundary();
00431 
00432      }
00433 
00434      //Computing Voronoi Cells:
00435      Seq<Cell2d*> nlist;
00436      this->b_leaves.dfs(nlist);// remove empty border bcells
00437 
00438      Cell2d* pr;
00439      pr= nlist[nlist.size()-1];
00440 
00441      foreach(Cell2d* cl2, nlist)
00442        //for (dfs.first(); !dfs.isDone(); dfs.next() )
00443       {
00444         // cl2= dfs.currentItem()->get_data();
00445         // std::cout<< *cl2 <<"\n";
00446 
00447         if ( cl2->is_corner() )
00448           pr=cl2;
00449         else {
00450           if ( (cl2->s_neighbors.size()==0 && 
00451                     cl2->intersections(0).size()==0 ) ||
00452                    (cl2->e_neighbors.size()==0 && 
00453                     cl2->intersections(1).size()==0 ) ||
00454                    (cl2->n_neighbors.size()==0 && 
00455                     cl2->intersections(2).size()==0 ) ||
00456                    (cl2->w_neighbors.size()==0 && 
00457                     cl2->intersections(3).size()==0 )  )
00458               {
00459                   this->b_leaves.push_edge(pr, this->b_leaves.next(cl2) ) ;
00460                   this->b_leaves.delete_vertex( cl2 ) ;
00461               }
00462               else
00463                   pr=cl2;
00464           }
00465       }
00466 
00467      std::cout<<"Border size= "<< nlist.size() <<std::endl;
00468 
00469       // Leaf graph
00470       //nlist.clear();
00471       //this->m_leaves.dfs(nlist);
00472 
00473       dfs= GraphDfsIter<Cell2d*>(m_leaves);
00474 
00475       for (dfs.first(); !dfs.isDone(); dfs.next() )
00476         //foreach(Cell2d* cl2, nlist)
00477       {
00478         cl2= dfs.currentItem()->get_data();
00479           //Cell * cl= dynamic_cast<Cell*>(cl);
00480           foreach(Cell2d* nb, cl2->neighbors() )
00481               this->m_leaves.push_edge( cl2,nb ) ;
00482       }
00483       
00484       std::cout<<"Leaf graph Ok." <<std::endl;
00485 
00486 
00488 
00489  //Remove inactive bcells OK ..
00490  // AND misleading edges 
00491  //Recover connected components .. ( for all regular bcells and sign +,-)
00492  // FOR ALL CC's:
00493  //1. check if CC is actually SCC .. 
00494  //2. walk on boundry and output face
00495 
00496    //get boundary
00497 
00498 //   nlist.clear();
00499 //   this->m_leaves.dfs(nlist);
00500 
00501    Point *p= NULL;
00502    Face * f= NULL;
00503    int sgn(1);
00504    unsigned site;//the site whose bcell is computed
00505 
00506    assert( nlist.size()>1);
00507 
00508    Cell2d// *s= NULL,
00509           *t= NULL,
00510           *b= NULL;
00511 
00512 
00513    // Start exploration
00514    //if (0) //Don't compute 2Dbcells
00515  for (dfs.first(); !dfs.isDone(); dfs.next() )
00516    {
00517      cl2= dfs.currentItem()->get_data();
00518 
00519      if (!( cl2->is_active()        &&
00520           (!this->b_leaves.member(cl2))   &&
00521           ((VCell*)cl2)->count() ==1 
00522            ))
00523      {  continue;  }
00524      
00525 
00526    //Every bisector box is visited twice
00527    switch ( cl2->m_gnode->aux() )
00528    {
00529    case 0:
00530      sgn=1 ;
00531    case -1 :
00532      sgn=1 ;
00533      break ;
00534    case  2 :
00535      sgn=-1;
00536    break   ;
00537    default :
00538      continue;
00539    }
00540    site=((VCell*)cl2)->site(sgn);//computing Voronoi Cell of "site"
00541 
00542 
00543    // Recovering site 
00544    f= new Face();
00545 
00546    // Get starting point (CCW)
00547    std::cout<<"Getting voronoi bcell of "<<site <<"("<<(sgn==1 ? "+": "-")
00548             <<"), starting "<< *cl2<<  std::endl;
00549    p= cl2->starting_point(sgn);
00550 //   std::cout<<"starting at "<< *p <<std::endl;
00551    // Walking on CCW face
00552    p= cl2->pair(p,sgn);
00553 //   std::cout<<"p= "<< *p <<std::endl;
00554    f->insert(p);
00555    b=cl2;
00556    
00557 //int c(0); 
00558    do  {
00559 //if (++c>137) {while(!stack.empty()) stack.pop(); exit(0);break;}
00560      //std::cout<<"Next"<< *b <<" sites= "<< ((VCell*)b)->sites()<<std::endl;
00561      //std::cout<<"."<<std::endl;
00562      //if ( !b->is_corner())
00563 
00564 
00565       if( this->m_leaves.member(b) ) {
00566       b->m_gnode->aux( b->m_gnode->aux() + (sgn==1 ? 2:-1) );
00567       //std::cout<<"aux="<<b->m_gnode->aux()<<std::endl; 
00568       }
00569       //else
00570       //  std::cout<<"Passed: "<< (*b) <<"\n";
00571 
00572 
00573       t= b->neighbor(p);
00574 
00575       //if ( t!=NULL)
00576       //  std::cout<<*t<<" is neighbor of "<<*b<<" for point "<<*p <<std::endl;
00577 
00578         // std::cout<<"Ints,b "<<b<<": "<<b->nb_intersect() <<std::endl;
00579         // foreach( Point* q, b->intersections() )
00580         //   std::cout<<"b: "<<": "<<*q  <<std::endl;
00581         // foreach( Cell2d* c, b->neighbors() )
00582         // {
00583         //   VCell* cc= dynamic_cast<VCell*>( c );
00584         //   std::cout<<"   Ints,t "<<"("<<cc->count() <<",sites="<<cc->sites()<<") "<<": "<<c->nb_intersect()<<", "<< *c <<", adr "<< cc <<std::endl;
00585         // foreach( Point* q, cc->intersections() )
00586         //   std::cout<<"   t: "<<": "<<*q  <<std::endl;
00587 
00588         //   foreach(Cell * m, cc->m_objects)        
00589         //     std::cout<<"   t-obj:"<< m <<std::endl;
00590 
00591 
00592         // }
00593 
00594       // if (b->m_singular.size() >0) 
00595       //  std::cout<<"Voronoi Vertex! "<< *b <<", " <<std::endl;
00596 
00597       //if (0)
00598       if ( t==NULL)
00599       { // border bcell reached
00600 
00601 //        std::cout<<"Border Cell "<<*b <<", #="<< ((VCell*)b)->nb_intersect() <<std::endl;
00602         //foreach( Point* q, b->intersections() )
00603         //    std::cout<< *q<<"   adr  "<<q<<std::endl; 
00604 
00605      //check meeting corner
00606           if          (b->s_neighbors.size()==0 &&
00607                        b->e_neighbors.size()==0 && b->intersections(1).size()==0)
00608            f->insert(new Point(b->xmax(),b->ymin(),0.0) );
00609           if    (b->e_neighbors.size()==0 &&
00610                        b->n_neighbors.size()==0 && b->intersections(2).size()==0)
00611            f->insert(new Point(b->xmax(),b->ymax(),0.0) );
00612           if   (b->n_neighbors.size()==0 &&
00613                        b->w_neighbors.size()==0 && b->intersections(3).size()==0)
00614            f->insert(new Point(b->xmin(),b->ymax(),0.0) );
00615           if   (b->w_neighbors.size()==0 &&
00616                        b->s_neighbors.size()==0 && b->intersections(0).size()==0)
00617              f->insert(new Point(b->xmin(),b->ymin(),0.0) );
00618 
00619 //          std::cout<<"Moving on border. ("<< this->m_faces.size()<<")"<< std::endl;
00620           b=this->b_leaves.next(b);
00621 //          std::cout<<"Moved to "<<*b <<" sites="<<((VCell*)b)->sites()<<std::endl;
00622 
00623           //check leaving corner
00624           if          (b->s_neighbors.size()==0 &&
00625                        b->e_neighbors.size()==0 && b->intersections(0).size()==0 )
00626           { f->insert(new Point(b->xmax(),b->ymin(),0.0) );
00627           }
00628           else if   (b->e_neighbors.size()==0 &&
00629                        b->n_neighbors.size()==0 && b->intersections(1).size()==0)
00630           { f->insert(new Point(b->xmax(),b->ymax(),0.0) );
00631           }
00632 
00633           else if   (b->n_neighbors.size()==0 &&
00634                        b->w_neighbors.size()==0 && b->intersections(2).size()==0)
00635           { f->insert(new Point(b->xmin(),b->ymax(),0.0) );
00636           }
00637           else if   (b->w_neighbors.size()==0 &&
00638                        b->s_neighbors.size()==0 && b->intersections(3).size()==0)
00639           {   f->insert(new Point(b->xmin(),b->ymin(),0.0) );
00640           }//end check corner
00641 
00642           if (  this->m_leaves.member(b) ) 
00643           {   //entering point. Changing bisector
00644             sgn=((VCell*)b)->signof(site);
00645             p= b->starting_point(sgn);
00646             f->insert(p);
00647             //std::cout<<"Entering from "<<*b<<" ,sgn="<<sgn<<std::endl;
00648             //std::cout<<"insert "<<*p<<std::endl;
00649             p= b->pair(p,sgn);
00650             f->insert(p);
00651             //std::cout<<"insert "<<*p<<std::endl;
00652             //std::cout<<"To : "<< *(b->neighbor(p)) <<std::endl;
00653           }
00654       }
00655       else
00656       { // next normal bcell
00657         //std::cout<<"next normal bcell "<<std::endl;
00658           b=t;
00659           if ( b->m_singular.size() > 0 )
00660               f->insert(b->m_singular[0]);
00661           p= b->pair(p,sgn);
00662           f->insert(p);
00663           //std::cout<<"p="<<*p<<std::endl;
00664       }
00665 
00666    } while (b!=cl2); 
00667    //(b->m_gnode->aux()==1 || b->m_gnode->aux()==-1 || b->m_gnode->aux()==2) );
00668 
00669    std::cout<<"Face ADDED ("<< this->m_faces.size()+1<<")" << std::endl;
00670    f->set_index(site);
00671    this->m_faces<< f;
00672 
00673 //  if (this->m_faces.size()== 14)  break;
00674 
00675    }// End exploration
00676 
00677   std::cout<<" # faces= "<< this->m_faces.size() << std::endl;
00678 
00679 
00680 }

void set_precision ( double  eps  )  [inline]

Definition at line 296 of file voronoi2dimpl.hpp.

References voronoi2dimpl< C, V >::m_minprec.

00296                                         {
00297   m_minprec = eps;
00298 }

void set_smoothness ( double  eps  )  [inline]

Definition at line 292 of file voronoi2dimpl.hpp.

References voronoi2dimpl< C, V >::m_maxprec.

00292                                          {
00293   m_maxprec = eps;
00294 }

unsigned const size ( void   )  [inline]

Definition at line 69 of file voronoi2dimpl.hpp.

References voronoi2dimpl< C, V >::m_sites.

00069 { return m_sites.size(); };

bool subdivide ( Cell bcell  )  [inline, protected]

Definition at line 256 of file voronoi2dimpl.hpp.

00257     { return mesher2d<C,V>::subdivide(bcell,NULL); };


Member Data Documentation

Definition at line 270 of file voronoi2dimpl.hpp.

Referenced by voronoi2dimpl< C, V >::run().

Definition at line 275 of file voronoi2dimpl.hpp.

Referenced by voronoi2dimpl< C, V >::run().

Definition at line 278 of file voronoi2dimpl.hpp.

Referenced by voronoi2dimpl< C, V >::run().

Definition at line 267 of file voronoi2dimpl.hpp.

Referenced by voronoi2dimpl< C, V >::insert_regular().

Definition at line 269 of file voronoi2dimpl.hpp.

Referenced by voronoi2dimpl< C, V >::run().

double m_maxprec
double m_minprec

Definition at line 265 of file voronoi2dimpl.hpp.

Referenced by voronoi2dimpl< C, V >::run().

std::list< voronoi_site2d<C,V > *> m_sites

The documentation for this class was generated from the following file:

Generated on 6 Dec 2012 for shape by  doxygen 1.6.1