voronoi2d< C, V > Class Template Reference

#include <voronoi2d.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::voronoi2d< C, V >

Definition at line 40 of file voronoi2d.hpp.


Member Typedef Documentation

Definition at line 48 of file voronoi2d.hpp.

typedef mesher2d<C,V>::Cell Cell

Definition at line 49 of file voronoi2d.hpp.

typedef mesher2d<C,V>::Cell2d Cell2d

Definition at line 50 of file voronoi2d.hpp.

typedef mesher2d<C,V>::Curve Curve

Definition at line 51 of file voronoi2d.hpp.

typedef mesher2d<C,V>::Edge Edge

Definition at line 46 of file voronoi2d.hpp.

typedef mesher2d<C,V>::Face Face

Definition at line 47 of file voronoi2d.hpp.

typedef kdtree<Cell*> Kdtree

Definition at line 55 of file voronoi2d.hpp.

typedef node<Cell*> Node

Definition at line 54 of file voronoi2d.hpp.

typedef mesher2d<C,V>::Point Point

Definition at line 45 of file voronoi2d.hpp.

typedef topology<C,V> Topology

Definition at line 52 of file voronoi2d.hpp.


Constructor & Destructor Documentation

voronoi2d ( const BoundingBox bx  )  [inline]

Definition at line 59 of file voronoi2d.hpp.

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

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

Definition at line 62 of file voronoi2d.hpp.

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


Member Function Documentation

bool insert_regular ( Cell bcell  )  [inline, protected]

Definition at line 79 of file voronoi2d.hpp.

References Cell2dVoronoiSite2d, EPSILON, bcell2d< C, V >::intersections(), cell< C, V >::is_active(), voronoi2d< C, V >::m_graph, voronoi2d< C, V >::m_objects, Graph< T >::push_uedge(), Graph< T >::push_vertex(), Seq< C, R >::size(), and VCell.

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

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

bool is_regular ( Cell bcell  )  [inline, protected]

Definition at line 73 of file voronoi2d.hpp.

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

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

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

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

Definition at line 282 of file voronoi2d.hpp.

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

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

void run ( void   )  [inline]

Definition at line 299 of file voronoi2d.hpp.

References assert, gNode< T >::aux(), voronoi2d< C, V >::b_leaves, Cell2dVoronoiSite2d, 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(), voronoi2d< C, V >::insert_regular(), bcell2d< C, V >::intersections(), cell< C, V >::is_active(), bcell2d< C, V >::is_border(), bcell2d< C, V >::is_corner(), voronoi2d< C, V >::is_regular(), GraphDfsIter< T >::isDone(), mmx::ssi::left(), voronoi2d< C, V >::m_bbx, voronoi2d< C, V >::m_faces, bcell2d< C, V >::m_gnode, voronoi2d< C, V >::m_leaves, voronoi2d< C, V >::m_maxprec, voronoi2d< C, V >::m_minprec, voronoi2d< C, V >::m_objects, voronoi2d< 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(), 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.

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

void set_precision ( double  eps  )  [inline]

Definition at line 294 of file voronoi2d.hpp.

References voronoi2d< C, V >::m_minprec.

00294                                         {
00295   m_minprec = eps;
00296 }

void set_smoothness ( double  eps  )  [inline]

Definition at line 290 of file voronoi2d.hpp.

References voronoi2d< C, V >::m_maxprec.

00290                                          {
00291   m_maxprec = eps;
00292 }

unsigned const size ( void   )  [inline]

Definition at line 67 of file voronoi2d.hpp.

References voronoi2d< C, V >::m_sites.

00067 { return m_sites.size(); };

bool subdivide ( Cell bcell  )  [inline, protected]

Definition at line 254 of file voronoi2d.hpp.

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


Member Data Documentation

Definition at line 268 of file voronoi2d.hpp.

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

Definition at line 273 of file voronoi2d.hpp.

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

Definition at line 276 of file voronoi2d.hpp.

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

Definition at line 265 of file voronoi2d.hpp.

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

Definition at line 267 of file voronoi2d.hpp.

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

double m_maxprec

Definition at line 270 of file voronoi2d.hpp.

Referenced by voronoi2d< C, V >::run(), and voronoi2d< C, V >::set_smoothness().

double m_minprec

Definition at line 271 of file voronoi2d.hpp.

Referenced by voronoi2d< C, V >::run(), and voronoi2d< C, V >::set_precision().

Definition at line 263 of file voronoi2d.hpp.

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

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

Definition at line 255 of file voronoi2d.hpp.

Referenced by voronoi2d< C, V >::push_back(), and voronoi2d< C, V >::size().


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

Generated on 6 Dec 2012 for shape by  doxygen 1.6.1