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

📄 sm_decorator.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
📖 第 1 页 / 共 3 页
字号:
void set_adjacency_at_source_between(SHalfedge_handle e1,                                      SHalfedge_handle e_between,                                      SHalfedge_handle e2)/*{\Mop inserts |e_between| into the adjacency list around |e1->source()|   between |e1| and |e2| and makes |e1->source()| the source of |e_between|.   \precond |e1->source()==e2->source()|.}*/{   e_between->source() = e1->source();  set_adjacency_at_source_between(e1,e_between);  set_adjacency_at_source_between(e_between,e2);}void close_tip_at_source(SHalfedge_handle e, SVertex_handle v) /*{\Mop sets |v| as source of |e| and closes the tip by setting the   corresponding pointers such that |prev(e) == e->twin()| and  |next(e->twin()) == e|.}*/{ link_as_source_of(e,v);   link_as_prev_next_pair(e->twin(),e); }void close_tip_at_target(SHalfedge_handle e, SVertex_handle v) /*{\Mop sets |v| as target of |e| and closes the tip by setting the   corresponding pointers such that |prev(e->twin()) == e| and   |e->snext() == e->twin()|.}*/{ link_as_target_of(e,v);  link_as_prev_next_pair(e,e->twin()); }void remove_from_adj_list_at_source(SHalfedge_handle e)/*{\Mop removes a halfedge pair |(e,e->twin()| from the adjacency listof |e->source()|. Afterwards |next(prev(e))==next(e->twin())| and|first_out_edge(e->source())| is valid if |degree(v->source())>1| beforethe operation.}*/{  SVertex_handle v = e->source();  if ( is_closed_at_source(e) ) { // last outgoing    v->out_sedge() = SHalfedge_handle();  } else {    if (e == first_out_edge(v)) v->out_sedge() = cap(e);    set_adjacency_at_source_between(cap(e),cas(e));  }}void set_face(SHalfedge_handle e, SFace_handle f) const{ e->incident_sface() = f; }void set_face(SHalfloop_handle l, SFace_handle f) const{ l->incident_sface() = f; }void set_face(SVertex_handle v, SFace_handle f) const{ v->incident_sface() = f; }void set_first_out_edge(SVertex_handle v, SHalfedge_handle e) const{ v->out_sedge() = e; }void set_prev(SHalfedge_handle e, SHalfedge_handle ep) const{ e->sprev() = ep; }void set_next(SHalfedge_handle e, SHalfedge_handle en) const{ e->snext() = en; }void set_source(SHalfedge_handle e, SVertex_handle v) const{ e->source() = v; }/*{\Mtext \headerline{Associated Information}\restoreopdims}*/void set_marks_in_face_cycle(SHalfedge_handle e, Mark m) const{ SHalfedge_around_sface_circulator hfc(e), hend(hfc);  CGAL_For_all(hfc,hend) hfc->mark() = hfc->target()->mark() = m;}GenPtr& info(SVertex_handle v) const{ return v->info(); }GenPtr& info(SHalfedge_handle e) const{ return e->info(); }GenPtr& info(SHalfloop_handle l) const{ return l->info(); }GenPtr& info(SFace_handle f) const{ return f->info(); }const GenPtr& info(SVertex_const_handle v) const{ return v->info(); }const GenPtr& info(SHalfedge_const_handle e) const{ return e->info(); }const GenPtr& info(SHalfloop_const_handle l) const{ return l->info(); }const GenPtr& info(SFace_const_handle f) const{ return f->info(); } /*{\Mtext \headerline{Iteration}}*//*{\Mtext The list of all objects can be accessed via iterator ranges.For comfortable iteration we also provide iterations macros. The iterator range access operations are of the following kind:\\|SVertex_iterator svertices_begin()/svertices_end()|\\|SHalfedge_iterator shalfedges_begin()/shalfedges_end()|\\|SHalfedge_iterator sedges_begin()/sedges_end()|\\|SFace_iterator sfaces_begin()/sfaces_end()|The macros are then |CGAL_forall_svertices_of(v,V)|,|CGAL_forall_shalfedges_of(e,V)|, |CGAL_forall_sedges_of(e,V)|, |CGAL_forall_sfaces_of(f,V)|, |CGAL_forall_sface_cycles_of(fc,F)|.}*/void transform( const Aff_transformation_3& linear) {  //  CGAL_NEF_TRACEN("transform sphere map of vertex" << center_vertex()->point());    // The affine transformation is linear, i.e., no translation part.    CGAL_precondition( linear.hm(0,3) == 0 &&                        linear.hm(1,3) == 0 &&                        linear.hm(2,3) == 0);    //    CGAL_NEF_TRACEN(linear);    for (SVertex_iterator i = svertices_begin(); i != svertices_end(); ++i)      i->point() = normalized(Sphere_point( i->point().transform( linear)));    for (SHalfedge_iterator i = shalfedges_begin(); i !=shalfedges_end(); ++i)      i->circle() = Sphere_circle( i->circle().transform( linear));    if ( has_shalfloop()) {      shalfloop()->circle() = Sphere_circle(shalfloop()->circle()					  .transform( linear));      shalfloop()->twin()->circle()	= Sphere_circle(shalfloop()->twin()->circle().transform( linear));    }}void extract_complement() {  SVertex_handle sv;  CGAL_forall_svertices(sv,*this) sv->mark() = !sv->mark();  SHalfedge_handle she;  CGAL_forall_shalfedges(she,*this) she->mark() = !she->mark();  SHalfloop_handle shl;  if(has_shalfloop()) {    shl = shalfloop();     shl->mark() = shl->twin()->mark() = !shl->mark();  }  SFace_handle sf;  CGAL_forall_sfaces(sf,*this)     sf->mark() = !sf->mark();}void extract_interior() {  SVertex_handle sv;  CGAL_forall_svertices(sv,*this) sv->mark() = false;  SHalfedge_handle she;  CGAL_forall_shalfedges(she,*this) she->mark() = false;  SHalfloop_handle shl;  if(has_shalfloop()) {     shl = shalfloop();     shl->mark() = shl->twin()->mark() = false;  }}void extract_boundary() {  SVertex_handle sv;  CGAL_forall_svertices(sv,*this) sv->mark() = true;  SHalfedge_handle she;  CGAL_forall_shalfedges(she,*this) she->mark() = true;  SHalfloop_handle shl;  if(has_shalfloop()) {     shl = shalfloop();     shl->mark() = shl->twin()->mark() = true;  }  SFace_handle sf;  CGAL_forall_sfaces(sf,*this) sf->mark() = false;}bool is_valid( Unique_hash_map<SVertex_handle,bool>& sv_hash,	       Unique_hash_map<SHalfedge_handle,bool>& se_hash,	       Unique_hash_map<SFace_handle,bool>& sf_hash,	       bool verb = false, int level = 0) {      Verbose_ostream verr(verb);  verr << "begin CGAL::SNC_SM_decorator<...>::is_valid( verb=true, "    "level = " << level << "):" << std::endl;      bool valid = true;  int count = 0;  int max = 2 * number_of_svertices()     + 2 * number_of_shalfedges()    + number_of_sfaces()    + 2;    SVertex_handle sv;  int isolated_vertices_found = 0;  CGAL_forall_svertices(sv,*this) {    valid = valid && (!sv_hash[sv]);    sv_hash[sv] = true;    if(is_isolated(sv))       isolated_vertices_found++;    valid = valid && (++count <= max);  }  SHalfedge_iterator she;  CGAL_forall_shalfedges(she,*this) {    valid = valid && she->is_valid(verb, level);    valid = valid && (she->twin() != she);    valid = valid && (she->twin()->twin() == she);    valid = valid && (she->snext()->sprev() == she);    valid = valid && ((she->sprev() != she && she->snext() != she) || 		      (she->sprev() == she && she->snext() == she));    valid = valid && (she->incident_sface() == she->snext()->incident_sface());    valid = valid && (she->incident_sface() == she->sprev()->incident_sface());    valid = valid && (!se_hash[she]);    //    Plane_3 pl(point(she->source()),point(she->target()),Point_3(0,0,0));    //    Sphere_point vct(pl.orthogonal_vector());    //    valid = valid && (normalized(Sphere_point(she->circle().orthogonal_vector())) == normalized(vct) ||     //	      normalized(Sphere_point(she->circle().opposite().orthogonal_vector())) == normalized(vct));    se_hash[she] = true;    valid = valid && (++count <= max);  }  if(has_shalfloop()) {    SHalfloop_handle shl = shalfloop();    valid = valid && shl->is_valid();    valid = valid && shl->twin()->is_valid();    valid = valid && (shl->twin() != shl);    valid = valid && (shl->twin()->twin() == shl);   }  SFace_iterator sf;  SFace_cycle_iterator sfc;    int loop_entries_found = 0;  int edge_entries_found = 0;  int vertex_entries_found = 0;  CGAL_forall_sfaces(sf,*this) {    valid = valid && sf->is_valid(verb, level);    valid = valid && (!sf_hash[sf]);    sf_hash[sf] = true;        CGAL_forall_sface_cycles_of(sfc,sf) {      if (sfc.is_shalfloop()) 	loop_entries_found++;      else if(sfc.is_shalfedge())	edge_entries_found++;      else if(sfc.is_svertex())	vertex_entries_found++;      valid = valid && (++count <= max);    }        valid = valid && (++count <= max);  }  if(has_shalfloop())    valid = valid && (loop_entries_found == 2);  else    valid = valid && (loop_entries_found == 0);  if(number_of_shalfedges() > 0)    valid = valid && (edge_entries_found > 0);  else    valid = valid && (edge_entries_found == 0);  valid = valid && (vertex_entries_found == isolated_vertices_found);  verr << "end of CGAL::SNC_SM_decorator<...>::is_valid(): structure is "       << ( valid ? "valid." : "NOT VALID.") << std::endl;  return valid;}  template <typename Selection>  void change_marks(const Mark& m, const Selection& SP) {       psm_->mark() = SP(m, psm_->mark());    SVertex_iterator v;    CGAL_forall_svertices(v,*this)      v->mark() = SP(m, v->mark());    SHalfedge_iterator e;    CGAL_forall_shalfedges(e,*this)      e->mark() = SP(m, e->mark());    SFace_iterator f;    CGAL_forall_sfaces(f,*this)       f->mark() = SP(m, f->mark());  }  template <typename Selection>  void change_marks(const Selection& SP, const Mark& m) {       psm_->mark() = SP(psm_->mark(), m);    SVertex_iterator v;    CGAL_forall_svertices(v,*this)      v->mark() = SP(v->mark(),m);    SHalfedge_iterator e;    CGAL_forall_shalfedges(e,*this)      e->mark() = SP(e->mark(),m);    SFace_iterator f;    CGAL_forall_sfaces(f,*this)       f->mark() = SP(f->mark(),m);  }void check_integrity_and_topological_planarity(bool faces=true) const {  SM_const_decorator C(psm_);  C.check_integrity_and_topological_planarity(faces);}}; // SM_decoratorCGAL_END_NAMESPACE#endif // CGAL_SM_DECORATOR_H

⌨️ 快捷键说明

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