⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pm_decorator.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
📖 第 1 页 / 共 3 页
字号:
        and |first_out_edge(source(e))| is valid if         |degree(source(v))>1| before the operation.}*/{  Vertex_handle vs = source(e);  if ( is_closed_at_source(e) ) { // last outgoing    vs->set_halfedge(Halfedge_handle());  } else {    if (e == first_out_edge(vs))       vs->set_halfedge(e->prev());    set_adjacency_at_source_between(cap(e),cas(e));  }}void unlink_as_hole(Halfedge_handle e) const/*{\Mop removes |e|'s existence as an face cycle entry point of |face(e)|.    Does not update the face links of the corresponding face cycle    halfedges.}*/{ e->face()->remove_fc(e); } void unlink_as_isolated_vertex(Vertex_handle v) const/*{\Mop removes |v|'s existence as an isolated vertex in |face(v)|.    Does not update |v|'s face link.}*/{ v->face()->remove_iv(v); }     void link_as_prev_next_pair(Halfedge_handle e1, Halfedge_handle e2) const /*{\Mop makes |e1| and |e2| adjacent in the face cycle $\ldots-|e1-e2|-\ldots$.    Afterwards |e1 = previous(e2)| and |e2 = next(e1)|.}*/{ e1->set_next(e2); e2->set_prev(e1); }void set_face(Halfedge_handle e, Face_handle f) const/*{\Mop makes |f| the face of |e|.}*/{ e->set_face(f); }void set_face(Vertex_handle v, Face_handle f) const/*{\Mop makes |f| the face of |v|.}*/{ v->set_face(f); }void set_halfedge(Face_handle f, Halfedge_handle e) const/*{\Mop makes |e| entry edge in the outer face cycle of |f|.}*/{ f->set_halfedge(e); }void set_hole(Face_handle f, Halfedge_handle e) const/*{\Mop makes |e| entry edge in a hole face cycle of |f|.}*/{ f->store_fc(e); }void set_isolated_vertex(Face_handle f, Vertex_handle v) const/*{\Mop makes |v| an isolated vertex of |f|.}*/{ f->store_iv(v); }/*{\Mtext \headerline{Cloning}\setopdims{2cm}{1cm}}*/void clone(const Plane_map& H) const;/*{\Mop clones |H| into |P|. Afterwards |P| is a copy of |H|.\\  \precond |H.check_integrity_and_topological_planarity()| and   |P| is empty.}*/#if ! defined(CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG)template <typename LINKDA>void clone_skeleton(const Plane_map& H, const LINKDA& L) const;/*{\Mop clones the skeleton of |H| into |P|. Afterwards |P| is a copy of |H|. The link data accessor allows to transfer information fromthe old to the new objects. It needs the function call operators:\\|void operator()(Vertex_handle vn, Ver\-tex_\-const_\-handle vo) const|\\|void operator()(Halfedge_handle hn, Half\-edge_\-const_\-handle ho) const|\\where |vn,hn| are the cloned objects and |vo,ho| are the originalobjects.\\\precond |H.check_integrity_and_topological_planarity()| and |P| is empty.}*/#elsetemplate <typename LINKDA>void clone_skeleton(const HDS& H, const LINKDA& L) const{  CGAL_assertion(number_of_vertices()==0&&                 number_of_halfedges()==0&&                 number_of_faces()==0);  PM_const_decorator<HDS> DC(H);  CGAL_assertion((DC.check_integrity_and_topological_planarity(),1));  CGAL::Unique_hash_map<Vertex_const_iterator,Vertex_handle>     Vnew;  CGAL::Unique_hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;  /* First clone all objects and store correspondance in the two maps.*/  Vertex_const_iterator vit, vend = H.vertices_end();  for (vit = H.vertices_begin(); vit!=vend; ++vit) {    Vertex_handle v = this->phds->vertices_push_back(Vertex_base());    Vnew[vit] = v;  }  Halfedge_const_iterator eit, eend = H.halfedges_end();  for (eit = H.halfedges_begin(); eit!=eend; ++(++eit)) {    Halfedge_handle e = this->phds->edges_push_back(Halfedge_base(),Halfedge_base());    Hnew[eit] = e; Hnew[eit->opposite()] = e->opposite();  }  /* Now copy topology.*/  Vertex_iterator vit2, vend2 = vertices_end();  for (vit = H.vertices_begin(), vit2 = vertices_begin();        vit2!=vend2; ++vit, ++vit2) {    mark(vit2) = DC.mark(vit);    point(vit2) = DC.point(vit);    if ( !DC.is_isolated(vit) )       vit2->set_halfedge(Hnew[vit->halfedge()]);    L(vit2,vit);  }  Halfedge_iterator eit2, eend2 = this->phds->halfedges_end();  for (eit = H.halfedges_begin(), eit2 = halfedges_begin();        eit2!=eend2; ++eit, ++eit2) {    eit2->set_prev(Hnew[eit->prev()]);    eit2->set_next(Hnew[eit->next()]);    eit2->set_vertex(Vnew[eit->vertex()]);    mark(eit2) = DC.mark(eit);    // eit2->set_face(Face_handle((Face*)&*(eit->face())));     L(eit2,eit);    // link to face of original  }}#endifvoid reflecting_inversion()/*{\Xop inverts the topological links corresponding to a reflectinginversion. Assume that the plane map is embedded into the x-y planeand one looks at it from the tip of the positive z-axis in space. Nowchange your view point to a point on the negative z-axis. As aconsequence faces are right of edges and adjacency list are clockwiseorder-preserving. This operation recreates our embedding invariant(faces are left of edges and adjacency lists are counterclockwise order-preserving).}*/{  // swap faces:  Halfedge_iterator e;  for (e = halfedges_begin(); e != halfedges_end(); ++(++e)) {    Face_handle f1 = face(e), f2 = face(twin(e));    e->set_face(f2); twin(e)->set_face(f1);  }  // reverse adjacency lists:  std::vector<Halfedge_handle> A;  Vertex_iterator v;  for (v = vertices_begin(); v != vertices_end(); ++v) {    if ( is_isolted(v) ) continue;    Halfedge_around_vertex_circulator h = out_edges(v), hend(h);    CGAL_For_all(h,hend) A.push_back(h);    int n = A.size();    for (int i=0; i<n; ++i)      set_adjacency_at_source_between(A[(i+1)%n],A[i],A[(i-1)%n]);  }  CGAL_assertion_msg(0,"test this");}/*{\Mtext \headerline{Associated Information}\restoreopdims}*/Point& point(Vertex_handle v) const/*{\Mop returns the embedding of |v|.}*/{ return v->point(); }Mark& mark(Vertex_handle v) const/*{\Mop returns the mark of |v|.}*/{ return v->mark(); }Mark& mark(Halfedge_handle e) const/*{\Mop returns the mark of |e|.}*/{ if (&*e < &*(e->opposite())) return e->mark();  else return e->opposite()->mark();} // we store the mark in the container with smaller memory address !Mark& mark(Face_handle f) const/*{\Mop returns the mark of |f|.}*/{ return f->mark(); }void set_marks_in_face_cycle(Halfedge_handle e, Mark m) const{  Halfedge_around_face_circulator hfc(e), hend(hfc);  CGAL_For_all(hfc,hend) {    mark(hfc) = mark(target(hfc)) = m;  }}GenPtr& info(Vertex_handle v) const/*{\Mop returns a generic information slot.}*/{ return v->info(); }GenPtr& info(Halfedge_handle e) const/*{\Mop returns a generic information slot.}*/{ return e->info(); }GenPtr& info(Face_handle f) const/*{\Mop returns a generic information slot.}*/{ return f->info(); }}; // PM_decorator<HDS>template <typename  HDS>void PM_decorator<HDS>::clone(const HDS& H) const{  CGAL_assertion(this->number_of_vertices()==0&&                 this->number_of_halfedges()==0&&                 this->number_of_faces()==0);  PM_const_decorator<HDS> DC(H);  CGAL_assertion((DC.check_integrity_and_topological_planarity(),1));  CGAL::Unique_hash_map<Vertex_const_iterator,Vertex_handle>     Vnew;  CGAL::Unique_hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;  CGAL::Unique_hash_map<Face_const_iterator,Face_handle>         Fnew;  /* First clone all objects and store correspondance in three maps.*/  Vertex_const_iterator vit, vend = H.vertices_end();  for (vit = H.vertices_begin(); vit!=vend; ++vit)     Vnew[vit] = this->phds->vertices_push_back(Vertex_base());  Halfedge_const_iterator eit, eend = H.halfedges_end();  for (eit = H.halfedges_begin(); eit!=eend; ++(++eit)) {    Hnew[eit] = this->phds->edges_push_back(Halfedge_base(),Halfedge_base());    Hnew[eit->opposite()] = Hnew[eit]->opposite();  }  Face_const_iterator fit, fend = H.faces_end();  for (fit = H.faces_begin(); fit!=fend; ++fit) {    Fnew[fit] = this->phds->faces_push_back(Face_base());  }  /* Now copy topology.*/  Vertex_iterator vit2, vend2 = this->phds->vertices_end();  for (vit = H.vertices_begin(), vit2 = vertices_begin();        vit2!=vend2; ++vit, ++vit2) {    mark(vit2) = DC.mark(vit);    point(vit2) = DC.point(vit);    if ( DC.is_isolated(vit) ) vit2->set_face(Fnew[vit->face()]);    else vit2->set_halfedge(Hnew[vit->halfedge()]);  }  Halfedge_iterator eit2, eend2 = this->phds->halfedges_end();  for (eit = H.halfedges_begin(), eit2 = halfedges_begin();        eit2!=eend2; ++eit, ++eit2) {    eit2->set_prev(Hnew[eit->prev()]);    eit2->set_next(Hnew[eit->next()]);    eit2->set_vertex(Vnew[eit->vertex()]);    eit2->set_face(Fnew[eit->face()]);    mark(eit2) = DC.mark(eit);  }  Face_iterator fit2, fend2 = faces_end();  for (fit = H.faces_begin(), fit2 = faces_begin();        fit2!=fend2; ++fit, ++fit2) {    fit2->set_halfedge(Hnew[fit->halfedge()]);      // outer face cycle    Hole_const_iterator fcit, fcend = holes_end(fit);    for (fcit = holes_begin(fit); fcit!=fcend; ++fcit) {      fit2->store_fc(Hnew[fcit]);    } // hole face cycles    Isolated_vertex_const_iterator ivit;    for (ivit = isolated_vertices_begin(fit);          ivit != isolated_vertices_end(fit); ++ivit)      fit2->store_iv(Vnew[ivit]);      // isolated vertices in the interior    mark(fit2) = DC.mark(fit);  }  CGAL_assertion((this->check_integrity_and_topological_planarity(),1));}#if ! defined(CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG)template <typename HDS>template <typename LINKDA>void PM_decorator<HDS>::clone_skeleton(const HDS& H, const LINKDA& L) const{  CGAL_assertion(this->number_of_vertices()==0&&                 this->number_of_halfedges()==0&&                 this->number_of_faces()==0);  PM_const_decorator<HDS> DC(H);  CGAL_assertion((DC.check_integrity_and_topological_planarity(),1));  CGAL::Unique_hash_map<Vertex_const_iterator,Vertex_handle>     Vnew;  CGAL::Unique_hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;  /* First clone all objects and store correspondance in the two maps.*/  Vertex_const_iterator vit, vend = H.vertices_end();  for (vit = H.vertices_begin(); vit!=vend; ++vit) {    Vertex_handle v = this->phds->vertices_push_back(Vertex_base());    Vnew[vit] = v;  }  Halfedge_const_iterator eit, eend = H.halfedges_end();  for (eit = H.halfedges_begin(); eit!=eend; ++(++eit)) {    Halfedge_handle e = this->phds->edges_push_back(Halfedge_base(),Halfedge_base());    Hnew[eit] = e; Hnew[eit->opposite()] = e->opposite();  }  /* Now copy topology.*/  Vertex_iterator vit2, vend2 = vertices_end();  for (vit = H.vertices_begin(), vit2 = vertices_begin();        vit2!=vend2; ++vit, ++vit2) {    mark(vit2) = DC.mark(vit);    point(vit2) = DC.point(vit);    if ( !DC.is_isolated(vit) )       vit2->set_halfedge(Hnew[vit->halfedge()]);    L(vit2,vit);  }  Halfedge_iterator eit2, eend2 = this->phds->halfedges_end();  for (eit = H.halfedges_begin(), eit2 = halfedges_begin();        eit2!=eend2; ++eit, ++eit2) {    eit2->set_prev(Hnew[eit->prev()]);    eit2->set_next(Hnew[eit->next()]);    eit2->set_vertex(Vnew[eit->vertex()]);    mark(eit2) = DC.mark(eit);    // eit2->set_face(Face_handle((Face*)&*(eit->face())));     L(eit2,eit);    // link to face of original  }}#endifCGAL_END_NAMESPACE#endif //CGAL_PM_DECORATOR_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -