#include <semialgebraic2d.hpp>
Definition at line 39 of file semialgebraic2d.hpp.
typedef mesher2d<C,V>::BoundingBox BoundingBox |
Reimplemented from mesher2d< C, V >.
Definition at line 46 of file semialgebraic2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 47 of file semialgebraic2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 48 of file semialgebraic2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 49 of file semialgebraic2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 44 of file semialgebraic2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 45 of file semialgebraic2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 53 of file semialgebraic2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 52 of file semialgebraic2d.hpp.
Definition at line 73 of file mesher2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 43 of file semialgebraic2d.hpp.
Reimplemented from mesher2d< C, V >.
Definition at line 50 of file semialgebraic2d.hpp.
semialgebraic2d | ( | void | ) | [inline] |
Definition at line 57 of file semialgebraic2d.hpp.
semialgebraic2d | ( | Curve * | curve | ) |
~semialgebraic2d | ( | void | ) | [inline] |
Definition at line 60 of file semialgebraic2d.hpp.
void add_input | ( | Shape * | s | ) | [inline, inherited] |
Definition at line 177 of file mesher2d.hpp.
References Seq< C, R >::push_back().
bcell< C, V > * get_input_cell | ( | ) | [inline, inherited] |
Definition at line 183 of file mesher2d.hpp.
References Seq< C, R >::size().
Referenced by mesher2d< C, V >::run().
Output* get_output | ( | void | ) | [inline, inherited] |
Definition at line 94 of file mesher2d.hpp.
Referenced by mesher2d< C, V >::insert_regular(), mesher2d< C, V >::insert_singular(), semialgebraic2d< C, V >::run(), mesher2d< C, V >::run(), and arrangement2d< C, V >::run().
double get_precision | ( | void | ) | [inline, inherited] |
Definition at line 86 of file mesher2d.hpp.
Referenced by mesher2d< C, V >::run().
double get_smoothness | ( | void | ) | [inline, inherited] |
Definition at line 85 of file mesher2d.hpp.
Referenced by mesher2d< C, V >::run().
bool insert_regular | ( | Cell * | bcell | ) | [inline, protected] |
Reimplemented from mesher2d< C, V >.
Definition at line 294 of file semialgebraic2d.hpp.
References bcell< C, V >::insert_regular().
bool insert_singular | ( | Cell * | bcell | ) | [inline, protected, inherited] |
Definition at line 299 of file mesher2d.hpp.
References mesher2d< C, V >::get_output(), and bcell< C, V >::insert_singular().
00299 { 00300 return cl->insert_singular(this->get_output()) ; 00301 }
void insert_singular | ( | Point * | p | ) | [inline, virtual] |
Reimplemented from mesher2d< C, V >.
Definition at line 305 of file semialgebraic2d.hpp.
References mesher2d< C, V >::m_specials.
00305 { 00306 this->m_specials<<p; 00307 }
bool is_regular | ( | Cell * | bcell | ) | [inline, protected] |
Reimplemented from mesher2d< C, V >.
Definition at line 289 of file semialgebraic2d.hpp.
References cell< C, V >::is_regular().
void run | ( | void | ) | [inline] |
Reimplemented from mesher2d< C, V >.
Definition at line 86 of file semialgebraic2d.hpp.
References assert, mesher2d< C, V >::b_leaves, Seq< C, R >::clear(), Graph< T >::delete_vertex(), Graph< T >::dfs(), bcell2d< C, V >::e_neighbors, mesher2d< C, V >::get_output(), face< C, V, POINT >::insert(), bcell2d< C, V >::intersections(), cell< C, V >::is_active(), bcell2d< C, V >::is_border(), bcell2d< C, V >::is_corner(), tpl3d< C, V >::m_faces, mesher2d< C, V >::m_leaves, Graph< T >::member(), bcell2d< C, V >::n_neighbors, bcell2d< C, V >::nb_intersect(), bcell2d< C, V >::neighbors(), Graph< T >::next(), Graph< T >::push_edge(), bcell2d< C, V >::s_neighbors, sgn(), Seq< C, R >::size(), STACK, and bcell2d< C, V >::w_neighbors.
00086 { 00087 // 00088 std::cout<<"Running subdivision" <<std::endl; 00089 00090 mesher2d<C,V>::run(); 00091 00092 std::cout<<"Computing Semi-algebraic set." <<std::endl; 00093 00094 Seq<Cell2d*> nlist; 00095 this->b_leaves.dfs(nlist);// remove empty border bcells 00096 Cell2d* pr; 00097 pr= nlist[nlist.size()-1]; 00098 //if (0) 00099 foreach(Cell2d* cl2, nlist) 00100 { 00101 if ( cl2->is_corner() ) 00102 pr=cl2; 00103 else { 00104 if ( (cl2->s_neighbors.size()==0 && 00105 cl2->intersections(0).size()==0 ) || 00106 (cl2->e_neighbors.size()==0 && 00107 cl2->intersections(1).size()==0 ) || 00108 (cl2->n_neighbors.size()==0 && 00109 cl2->intersections(2).size()==0 ) || 00110 (cl2->w_neighbors.size()==0 && 00111 cl2->intersections(3).size()==0 ) ) 00112 { 00113 this->b_leaves.push_edge(pr, this->b_leaves.next(cl2) ) ; 00114 this->b_leaves.delete_vertex( cl2 ) ; 00115 } 00116 else 00117 pr=cl2; 00118 } 00119 } 00120 std::cout<<"Border Ok." <<std::endl; 00121 00122 // Leaf graph 00123 nlist.clear(); 00124 this->m_leaves.dfs(nlist); 00125 foreach(Cell2d* cl2, nlist) 00126 { 00127 //Cell * cl= dynamic_cast<Cell*>(cl); 00128 foreach(Cell2d* nb, cl2->neighbors() ) 00129 this->m_leaves.push_edge( cl2,nb ) ; 00130 } 00131 //remove interior bcells 00132 if (0)//done at subdivision time 00133 foreach(Cell2d* cl, nlist) { 00134 if (!cl->is_active() )//|| !cl->is_touching() ) 00135 { 00136 this->m_leaves.delete_vertex(cl); 00137 } 00138 } 00139 00140 00141 std::cout<<"Leaf graph Ok." <<std::endl; 00142 00143 00145 00146 //Remove inactive bcells OK .. 00147 // AND misleading edges 00148 //Recover connected components .. ( for all regular bcells and sign +,-) 00149 // FOR ALL CC's: 00150 //1. check if CC is actually SCC .. 00151 //2. walk on boundry and output face 00152 00153 //get boundary 00154 00155 // nlist.clear(); 00156 // this->m_leaves.dfs(nlist); 00157 00158 Point *p= NULL; 00159 Face * f= NULL; 00160 int aux; 00161 int sgn(1); 00162 assert( nlist.size()>1); 00163 00164 Cell2d *s= NULL, 00165 *t= NULL, 00166 *b= NULL; 00167 STACK stack; 00168 00169 // Start exploration 00170 foreach(Cell2d* cl, nlist) 00171 if ( cl->is_active() && 00172 //cl->is_regular() && 00173 cl->nb_intersect()==2 00174 && !cl->is_border() ) 00175 stack.push(cl); 00176 00177 sgn=1; 00178 //if (0) 00179 while ( !stack.empty() ) 00180 { 00181 s= stack.top(); 00182 aux=s->m_gnode->aux(); 00183 00184 //-- only (+) faces 00185 //thus if bcell is visited once then it is removed 00186 if (aux!=0) 00187 { 00188 stack.pop(); 00189 continue; 00190 } 00191 00192 // Recovering face (s,sgn) 00193 f= new Face(); 00194 00195 // Get starting point (CCW) 00196 //std::cout<<"Getting ("<<(sgn==1 ? "+": "-") 00197 // <<") face starting at "<< *s<< std::endl; 00198 p= s->starting_point(sgn); 00199 00200 // Walking on CCW face 00201 p= s->pair(p,sgn); 00202 f->insert(p); 00203 b=s; 00204 00205 //int c(0); 00206 do { 00207 //if (++c>320) {while(!stack.empty()) stack.pop(); exit(0);break;} 00208 //std::cout<<"Next"<<b <<std::endl; 00209 //if ( !b->is_corner()) 00210 //std::cout<<"aux="<<b->m_gnode->aux()<<std::endl; 00211 00212 if( this->m_leaves.member(b) ) { 00213 aux=b->m_gnode->aux(); 00214 b->m_gnode->aux(aux + (sgn==1 ? 2:-1) ); } 00215 00216 t= b->neighbor(p); 00217 00218 if ( t==NULL) 00219 { // border bcell reached 00220 00221 //std::cout<<"Border bcell "<< *b <<std::endl; 00222 00223 //check meeting corner 00224 if (b->s_neighbors.size()==0 && 00225 b->e_neighbors.size()==0 && b->intersections(1).size()==0) 00226 f->insert(new Point(b->xmax(),b->ymin(),0.0) ); 00227 if (b->e_neighbors.size()==0 && 00228 b->n_neighbors.size()==0 && b->intersections(2).size()==0) 00229 f->insert(new Point(b->xmax(),b->ymax(),0.0) ); 00230 if (b->n_neighbors.size()==0 && 00231 b->w_neighbors.size()==0 && b->intersections(3).size()==0) 00232 f->insert(new Point(b->xmin(),b->ymax(),0.0) ); 00233 if (b->w_neighbors.size()==0 && 00234 b->s_neighbors.size()==0 && b->intersections(0).size()==0) 00235 f->insert(new Point(b->xmin(),b->ymin(),0.0) ); 00236 00237 b=this->b_leaves.next(b); 00238 00239 //check leaving corner 00240 if (b->s_neighbors.size()==0 && 00241 b->e_neighbors.size()==0 && b->intersections(0).size()==0 ) 00242 { f->insert(new Point(b->xmax(),b->ymin(),0.0) ); 00243 } else if (b->e_neighbors.size()==0 && 00244 b->n_neighbors.size()==0 && b->intersections(1).size()==0) 00245 { f->insert(new Point(b->xmax(),b->ymax(),0.0) ); 00246 } else if (b->n_neighbors.size()==0 && 00247 b->w_neighbors.size()==0 && b->intersections(2).size()==0) 00248 { f->insert(new Point(b->xmin(),b->ymax(),0.0) ); 00249 } else if (b->w_neighbors.size()==0 && 00250 b->s_neighbors.size()==0 && b->intersections(3).size()==0) 00251 { f->insert(new Point(b->xmin(),b->ymin(),0.0) ); 00252 }//end check corner 00253 00254 if ( this->m_leaves.member(b) ) 00255 { //entering point 00256 //std::cout<<"Entered at "<< *b <<std::endl; 00257 p= b->starting_point(sgn); 00258 //std::cout<<"first point "<< *p <<std::endl; 00259 f->insert(p); 00260 p= b->pair(p,sgn); 00261 //std::cout<<"pair point "<< *p <<std::endl; 00262 f->insert(p); 00263 } 00264 } 00265 else 00266 { // next normal bcell 00267 b=t; 00268 if ( b->m_singular.size()==1 ) 00269 f->insert(b->m_singular[0]); 00270 p= b->pair(p,sgn); 00271 f->insert(p); 00272 } 00273 00274 } while (b!=s); 00275 //(b->m_gnode->aux()==1 || b->m_gnode->aux()==-1 || b->m_gnode->aux()==2) ); 00276 00277 //std::cout<<"Face Added" << std::endl; 00278 this->get_output()->m_faces<< f; 00279 00280 //if (this->m_faces.size()==2) break; 00281 00282 }// End exploration 00283 00284 std::cout<<" # faces= "<< this->get_output()->m_faces.size() << std::endl; 00285 00286 }
void set_input_bbox | ( | const BoundingBox & | bx | ) | [inline, inherited] |
Definition at line 170 of file mesher2d.hpp.
References bounding_box< C, V >::set_zmax(), and bounding_box< C, V >::set_zmin().
void set_precision | ( | double | e | ) | [inline, inherited] |
Definition at line 83 of file mesher2d.hpp.
void set_smoothness | ( | double | e | ) | [inline, inherited] |
Definition at line 82 of file mesher2d.hpp.
typedef SHAPE_OF | ( | V | ) | [inherited] |
bool singularity | ( | Cell * | bcell | ) | [inline, protected] |
Definition at line 299 of file semialgebraic2d.hpp.
References bcell< C, V >::insert_singular().
Reimplemented from mesher2d< C, V >.
Definition at line 310 of file semialgebraic2d.hpp.
References node< _CELL >::LEFT, mmx::ssi::left(), node< _CELL >::m_left, node< _CELL >::m_right, node< _CELL >::RIGHT, mmx::ssi::right(), and bcell< C, V >::subdivide().
00310 { 00311 int v=0; 00312 00313 Cell* left, * right; 00314 v = cl->subdivide(left, right) ; 00315 00316 node->m_left = new Node(node, left, Node::LEFT, v); 00317 m_nodes << node->m_left ; 00318 node->m_right = new Node(node, right, Node::RIGHT, v); 00319 m_nodes << node->m_right; 00320 00321 return true ; 00322 }
Definition at line 130 of file mesher2d.hpp.
Referenced by semialgebraic2d< C, V >::run(), mesher2d< C, V >::run(), and arrangement2d< C, V >::run().
Definition at line 128 of file mesher2d.hpp.
Definition at line 129 of file mesher2d.hpp.
Referenced by semialgebraic2d< C, V >::run(), mesher2d< C, V >::run(), and arrangement2d< C, V >::run().
Seq<Point*> m_specials [inherited] |
Definition at line 140 of file mesher2d.hpp.
Referenced by semialgebraic2d< C, V >::insert_singular(), mesher2d< C, V >::insert_singular(), and arrangement2d< C, V >::insert_singular().