shape_doc 0.1
|
#include <semialgebraic2d.hpp>
Definition at line 39 of file semialgebraic2d.hpp.
typedef topology2d<C,V>::BoundingBox BoundingBox |
Reimplemented from topology2d< C, V >.
Definition at line 46 of file semialgebraic2d.hpp.
typedef topology2d<C,V>::Cell Cell |
Reimplemented from topology2d< C, V >.
Definition at line 47 of file semialgebraic2d.hpp.
typedef topology2d<C,V>::Cell2d Cell2d |
Reimplemented from topology2d< C, V >.
Definition at line 48 of file semialgebraic2d.hpp.
typedef topology2d<C,V>::Curve Curve |
Reimplemented from topology2d< C, V >.
Definition at line 49 of file semialgebraic2d.hpp.
typedef topology2d<C,V>::Edge Edge |
Reimplemented from topology2d< C, V >.
Definition at line 44 of file semialgebraic2d.hpp.
typedef topology2d<C,V>::Face Face |
Reimplemented from topology2d< C, V >.
Definition at line 45 of file semialgebraic2d.hpp.
Reimplemented from topology2d< C, V >.
Definition at line 53 of file semialgebraic2d.hpp.
Reimplemented from topology2d< C, V >.
Definition at line 52 of file semialgebraic2d.hpp.
typedef topology2d<C,V>::Point Point |
Reimplemented from topology2d< C, V >.
Definition at line 43 of file semialgebraic2d.hpp.
Reimplemented from topology2d< C, V >.
Definition at line 50 of file semialgebraic2d.hpp.
Definition at line 58 of file topology.hpp.
semialgebraic2d | ( | const BoundingBox & | bx | ) | [inline] |
Definition at line 57 of file semialgebraic2d.hpp.
: topology2d<C,V>(bx){ };
semialgebraic2d | ( | Curve * | curve | ) |
~semialgebraic2d | ( | void | ) | [inline] |
Definition at line 59 of file semialgebraic2d.hpp.
{ delete this->m_tree ; };
unsigned count | ( | void | ) | [inline, inherited] |
Definition at line 84 of file topology.hpp.
References topology< C, V >::m_objects.
{ return m_objects.size(); }
Seq<Edge*> edges | ( | void | ) | const [inline, inherited] |
Definition at line 149 of file topology2d.hpp.
References topology2d< C, V >::m_edges.
{ return m_edges ; }
Edge* edges | ( | int | i | ) | const [inline, inherited] |
Definition at line 150 of file topology2d.hpp.
References topology2d< C, V >::m_edges.
{ return m_edges[i] ; }
void insert | ( | Edge * | e | ) | [virtual, inherited] |
Implements topology< C, V >.
Definition at line 409 of file topology2d.hpp.
void insert | ( | BoundingBox * | bx, |
bool | cross = false |
||
) | [virtual, inherited] |
Definition at line 111 of file topology.hpp.
References Edge, mmx::shape::insert(), bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), bounding_box< C, V >::ymin(), bounding_box< C, V >::zmax(), and bounding_box< C, V >::zmin().
{ Point *p0= new Point(bx->xmin(),bx->ymin(),bx->zmin()), *p1= new Point(bx->xmin(),bx->ymax(),bx->zmin()), *p2= new Point(bx->xmax(),bx->ymax(),bx->zmin()), *p3= new Point(bx->xmax(),bx->ymin(),bx->zmin()); this->insert(p0);this->insert(p1); this->insert(new Edge(p0,p1)); this->insert(p1);this->insert(p2); this->insert(new Edge(p1,p2)); this->insert(p2);this->insert(p3); this->insert(new Edge(p2,p3)); this->insert(p3);this->insert(p0); this->insert(new Edge(p3,p0)); Point *q0= new Point(bx->xmin(),bx->ymin(),bx->zmax()), *q1= new Point(bx->xmin(),bx->ymax(),bx->zmax()), *q2= new Point(bx->xmax(),bx->ymax(),bx->zmax()), *q3= new Point(bx->xmax(),bx->ymin(),bx->zmax()); this->insert(q0);this->insert(q1); this->insert(new Edge(q0,q1)); this->insert(q1);this->insert(q2); this->insert(new Edge(q1,q2)); this->insert(q2);this->insert(q3); this->insert(new Edge(q2,q3)); this->insert(q3);this->insert(q0); this->insert(new Edge(q3,q0)); this->insert(p0);this->insert(q0);this->insert(new Edge(p0,q0)); this->insert(p1);this->insert(q1);this->insert(new Edge(p1,q1)); this->insert(p2);this->insert(q2);this->insert(new Edge(p2,q2)); this->insert(p3);this->insert(q3);this->insert(new Edge(p3,q3)); if(cross) { Point *r0= new Point(bx->xmin(),bx->ymin(),bx->zmax()), *r1= new Point(bx->xmin(),bx->ymax(),bx->zmax()), *r2= new Point(bx->xmax(),bx->ymax(),bx->zmax()), *r3= new Point(bx->xmax(),bx->ymin(),bx->zmax()); this->insert(r0);this->insert(r2);this->insert(new Edge(r0,r2)); this->insert(r1);this->insert(r3);this->insert(new Edge(r1,r3)); } }
void insert | ( | Point * | p | ) | [virtual, inherited] |
Implements topology< C, V >.
Definition at line 401 of file topology2d.hpp.
References vertex< C, V, N >::index(), and vertex< C, V, N >::set_index().
Referenced by cell2d_algebraic_curve< C, V >::insert_regular(), and cell2d_algebraic_curve< C, V >::insert_singular().
{ if(p->index()<0) { p->set_index(this->m_vertices.size()); this->m_vertices << p; this->m_graph.push_vertex(p); } }
bool insert_regular | ( | Cell * | cell | ) | [protected] |
Reimplemented from topology2d< C, V >.
Definition at line 293 of file semialgebraic2d.hpp.
References cell< C, V >::insert_regular().
{ return cl->insert_regular(this); }
void insert_singular | ( | Point * | p | ) | [virtual] |
Reimplemented from topology2d< C, V >.
Definition at line 304 of file semialgebraic2d.hpp.
{ this->m_specials<<p; }
bool is_regular | ( | Cell * | cell | ) | [protected] |
Reimplemented from topology2d< C, V >.
Definition at line 288 of file semialgebraic2d.hpp.
References cell< C, V >::is_regular().
{
return cl->is_regular();
}
int nbe | ( | ) | const [inline, inherited] |
Definition at line 146 of file topology2d.hpp.
References topology2d< C, V >::m_edges.
{ return m_edges.size();}
int nbv | ( | void | ) | const [inline, inherited] |
Definition at line 145 of file topology2d.hpp.
References topology2d< C, V >::m_vertices.
{ return m_vertices.size();}
void operator<< | ( | Shape * | s | ) | [inline, inherited] |
Definition at line 82 of file topology.hpp.
References topology< C, V >::m_objects.
{ m_objects.push_back(s); }
void push_back | ( | Shape * | s | ) | [inline, inherited] |
Definition at line 81 of file topology.hpp.
References topology< C, V >::m_objects.
{ m_objects.push_back(s); }
void run | ( | void | ) |
Reimplemented from topology2d< C, V >.
Definition at line 85 of file semialgebraic2d.hpp.
References cell2d< C, V >::e_neighbors, Face, face< C, V, POINT >::insert(), cell2d< C, V >::intersections(), cell< C, V >::is_active(), cell2d< C, V >::is_border(), cell2d< C, V >::is_corner(), cell2d< C, V >::n_neighbors, cell2d< C, V >::nb_intersect(), cell2d< C, V >::neighbors(), topology2d< C, V >::run(), cell2d< C, V >::s_neighbors, face< C, V, POINT >::size(), STACK, and cell2d< C, V >::w_neighbors.
{ // std::cout<<"Running subdivision" <<std::endl; topology2d<C,V>::run(); std::cout<<"Computing Semi-algebraic set." <<std::endl; Seq<Cell2d*> nlist; this->b_leaves.dfs(nlist);// remove empty border cells Cell2d* pr; pr= nlist[nlist.size()-1]; //if (0) foreach(Cell2d* cl2, nlist) { if ( cl2->is_corner() ) pr=cl2; else { if ( (cl2->s_neighbors.size()==0 && cl2->intersections(0).size()==0 ) || (cl2->e_neighbors.size()==0 && cl2->intersections(1).size()==0 ) || (cl2->n_neighbors.size()==0 && cl2->intersections(2).size()==0 ) || (cl2->w_neighbors.size()==0 && cl2->intersections(3).size()==0 ) ) { this->b_leaves.push_edge(pr, this->b_leaves.next(cl2) ) ; this->b_leaves.delete_vertex( cl2 ) ; } else pr=cl2; } } std::cout<<"Border Ok." <<std::endl; // Leaf graph nlist.clear(); this->m_leaves.dfs(nlist); foreach(Cell2d* cl2, nlist) { //Cell * cl= dynamic_cast<Cell*>(cl); foreach(Cell2d* nb, cl2->neighbors() ) this->m_leaves.push_edge( cl2,nb ) ; } //remove interior cells if (0)//done at subdivision time foreach(Cell2d* cl, nlist) { if (!cl->is_active() )//|| !cl->is_touching() ) { this->m_leaves.delete_vertex(cl); } } std::cout<<"Leaf graph Ok." <<std::endl; //Remove inactive cells OK .. // AND misleading edges //Recover connected components .. ( for all regular cells and sign +,-) // FOR ALL CC's: //1. check if CC is actually SCC .. //2. walk on boundry and output face //get boundary // nlist.clear(); // this->m_leaves.dfs(nlist); Point *p= NULL; Face * f= NULL; int aux; int sgn(1); assert( nlist.size()>1); Cell2d *s= NULL, *t= NULL, *b= NULL; STACK stack; // Start exploration foreach(Cell2d* cl, nlist) if ( cl->is_active() && //cl->is_regular() && cl->nb_intersect()==2 && !cl->is_border() ) stack.push(cl); sgn=1; //if (0) while ( !stack.empty() ) { s= stack.top(); aux=s->m_gnode->aux(); //-- only (+) faces //thus if cell is visited once then it is removed if (aux!=0) { stack.pop(); continue; } // Recovering face (s,sgn) f= new Face(); // Get starting point (CCW) //std::cout<<"Getting ("<<(sgn==1 ? "+": "-") // <<") face starting at "<< *s<< std::endl; p= s->starting_point(sgn); // Walking on CCW face p= s->pair(p,sgn); f->insert(p); b=s; //int c(0); do { //if (++c>320) {while(!stack.empty()) stack.pop(); exit(0);break;} //std::cout<<"Next"<<b <<std::endl; //if ( !b->is_corner()) //std::cout<<"aux="<<b->m_gnode->aux()<<std::endl; if( this->m_leaves.member(b) ) { aux=b->m_gnode->aux(); b->m_gnode->aux(aux + (sgn==1 ? 2:-1) ); } t= b->neighbor(p); if ( t==NULL) { // border cell reached //std::cout<<"Border cell "<< *b <<std::endl; //check meeting corner if (b->s_neighbors.size()==0 && b->e_neighbors.size()==0 && b->intersections(1).size()==0) f->insert(new Point(b->xmax(),b->ymin(),0.0) ); if (b->e_neighbors.size()==0 && b->n_neighbors.size()==0 && b->intersections(2).size()==0) f->insert(new Point(b->xmax(),b->ymax(),0.0) ); if (b->n_neighbors.size()==0 && b->w_neighbors.size()==0 && b->intersections(3).size()==0) f->insert(new Point(b->xmin(),b->ymax(),0.0) ); if (b->w_neighbors.size()==0 && b->s_neighbors.size()==0 && b->intersections(0).size()==0) f->insert(new Point(b->xmin(),b->ymin(),0.0) ); b=this->b_leaves.next(b); //check leaving corner if (b->s_neighbors.size()==0 && b->e_neighbors.size()==0 && b->intersections(0).size()==0 ) { f->insert(new Point(b->xmax(),b->ymin(),0.0) ); } else if (b->e_neighbors.size()==0 && b->n_neighbors.size()==0 && b->intersections(1).size()==0) { f->insert(new Point(b->xmax(),b->ymax(),0.0) ); } else if (b->n_neighbors.size()==0 && b->w_neighbors.size()==0 && b->intersections(2).size()==0) { f->insert(new Point(b->xmin(),b->ymax(),0.0) ); } else if (b->w_neighbors.size()==0 && b->s_neighbors.size()==0 && b->intersections(3).size()==0) { f->insert(new Point(b->xmin(),b->ymin(),0.0) ); }//end check corner if ( this->m_leaves.member(b) ) { //entering point //std::cout<<"Entered at "<< *b <<std::endl; p= b->starting_point(sgn); //std::cout<<"first point "<< *p <<std::endl; f->insert(p); p= b->pair(p,sgn); //std::cout<<"pair point "<< *p <<std::endl; f->insert(p); } } else { // next normal cell b=t; if ( b->m_singular.size()==1 ) f->insert(b->m_singular[0]); p= b->pair(p,sgn); f->insert(p); } } while (b!=s); //(b->m_gnode->aux()==1 || b->m_gnode->aux()==-1 || b->m_gnode->aux()==2) ); //std::cout<<"Face Added" << std::endl; this->m_faces<< f; //if (this->m_faces.size()==2) break; }// End exploration std::cout<<" # faces= "<< this->m_faces.size() << std::endl; }
void set_precision | ( | double | eps | ) | [inherited] |
Reimplemented in subdivision< C, with_tpl3d< V >, SURFACE, CELL >.
Definition at line 107 of file topology.hpp.
{ m_minprec = eps; }
void set_smoothness | ( | double | eps | ) | [inherited] |
Reimplemented in subdivision< C, with_tpl3d< V >, SURFACE, CELL >.
Definition at line 103 of file topology.hpp.
{ m_maxprec = eps; }
typedef SHAPE_OF | ( | V | ) | [inherited] |
bool singularity | ( | Cell * | cell | ) | [protected] |
Reimplemented from topology2d< C, V >.
Definition at line 298 of file semialgebraic2d.hpp.
References cell< C, V >::insert_singular().
{ // this->insert((BoundingBox*)cl); return cl->insert_singular(this) ; }
Reimplemented from topology2d< C, V >.
Definition at line 309 of file semialgebraic2d.hpp.
References mmx::shape_ssi::left(), node< _Object, _CELL >::m_left, node< _Object, _CELL >::m_right, Node, mmx::shape_ssi::right(), and cell< C, V >::subdivide().
{ int v=0; Cell* left, * right; v = cl->subdivide(left, right) ; node->m_left = new Node(node, left, Node::LEFT, v); m_nodes << node->m_left ; node->m_right = new Node(node, right, Node::RIGHT, v); m_nodes << node->m_right; return true ; }
Point* vertices | ( | int | i | ) | const [inline, inherited] |
Definition at line 148 of file topology2d.hpp.
References topology2d< C, V >::m_vertices.
{ return m_vertices[i] ; }
Definition at line 143 of file topology2d.hpp.
BoundingBox m_bbx [inherited] |
Definition at line 91 of file topology.hpp.
Definition at line 137 of file topology2d.hpp.
Referenced by topology2d< C, V >::edges(), and topology2d< C, V >::nbe().
Definition at line 138 of file topology2d.hpp.
Definition at line 140 of file topology2d.hpp.
Definition at line 142 of file topology2d.hpp.
double m_maxprec [inherited] |
Definition at line 88 of file topology.hpp.
double m_minprec [inherited] |
Definition at line 89 of file topology.hpp.
Definition at line 92 of file topology.hpp.
Referenced by topology< C, V >::count(), topology< C, V >::operator<<(), topology< C, V >::push_back(), and topology2d< C, V >::topology2d().
Seq<Point*> m_specials [inherited] |
Definition at line 152 of file topology2d.hpp.
Referenced by cell2d_algebraic_curve< C, V >::insert_regular(), and cell2d_algebraic_curve< C, V >::insert_singular().
Seq<Point*> m_vertices [inherited] |
Definition at line 136 of file topology2d.hpp.
Referenced by topology2d< C, V >::nbv(), and topology2d< C, V >::vertices().