sm_decorator.h

来自「CGAL is a collaborative effort of severa」· C头文件 代码 · 共 1,028 行 · 第 1/3 页

H
1,028
字号
// Copyright (c) 1997-2002  Max-Planck-Institute Saarbruecken (Germany).// All rights reserved.//// This file is part of CGAL (www.cgal.org); you may redistribute it under// the terms of the Q Public License version 1.0.// See the file LICENSE.QPL distributed with CGAL.//// Licensees holding a valid commercial license may use this file in// accordance with the commercial license agreement provided with the software.//// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.//// $Source: /CVSROOT/CGAL/Packages/Nef_S2/include/CGAL/Nef_S2/SM_decorator.h,v $// $Revision: 1.17.2.1 $ $Date: 2004/12/08 20:10:09 $// $Name:  $//// Author(s)     : Michael Seel       <seel@mpi-sb.mpg.de>//                 Miguel Granados    <granados@mpi-sb.mpg.de>//                 Susan Hert         <hert@mpi-sb.mpg.de>//                 Lutz Kettner       <kettner@mpi-sb.mpg.de>//                 Peter Hachenberger <hachenberger@mpi-sb.mpg.de>#ifndef CGAL_SM_DECORATOR_H #define CGAL_SM_DECORATOR_H#include <CGAL/basic.h>#include <CGAL/Nef_S2/SM_const_decorator.h>#undef CGAL_NEF_DEBUG#define CGAL_NEF_DEBUG  23#include <CGAL/Nef_2/debug.h>#include <CGAL/Nef_S2/SM_decorator_traits.h>#include <CGAL/Nef_S2/Sphere_map.h>#include <CGAL/Nef_S2/Normalizing.h>#include <CGAL/Unique_hash_map.h>#include <CGAL/IO/Verbose_ostream.h>CGAL_BEGIN_NAMESPACE/*{\Moptions print_title=yes }*/ /*{\Moptions outfile=SM_decorator.man }*//*{\Manpage {SM_decorator}{Sphere_map}{Topological sphere map decorator}{D}}*/template <typename Map_>class SM_decorator{ public:typedef Map_              Map;typedef Map_              Sphere_map;typedef SM_decorator<Map> Self;typedef SM_decorator_traits<Map>  Decorator_traits;/*{\Mdefinition ...}*//*{\Mtypes 5}*/typedef SM_const_decorator<Map>   SM_const_decorator;typedef typename Map::Sphere_kernel    Sphere_kernel;/*{\Mtypemember spherical geometry.}*/typedef typename Map::Sphere_point     Sphere_point;/*{\Mtypemember embedding vertices.}*/typedef typename Map::Sphere_segment   Sphere_segment;/*{\Mtypemember embedding edges.}*/typedef typename Map::Sphere_circle    Sphere_circle;/*{\Mtypemember embedding loops.}*/typedef typename Map::Sphere_direction Sphere_direction;/*{\Mtypemember embedding directions.}*/typedef typename Map::Mark   Mark;/*{\Mtypemember attributes of objects (vertices, edges, faces).}*/typedef size_t Size_type;/*{\Mtypemember size type.}*/enum { BEFORE = -1, AFTER = 1 };/*{\Menum insertion order labels.}*/typedef typename Sphere_kernel::Aff_transformation_3 Aff_transformation_3;typedef void*  GenPtr;typedef typename Map::SVertex                   SVertex;typedef typename Map::SVertex_handle            SVertex_handle;typedef typename Map::SVertex_iterator          SVertex_iterator;typedef typename Map::SVertex_const_handle      SVertex_const_handle;typedef typename Map::SVertex_const_iterator    SVertex_const_iterator;typedef typename Map::SHalfedge                 SHalfedge;typedef typename Map::SHalfedge_handle          SHalfedge_handle;typedef typename Map::SHalfedge_iterator        SHalfedge_iterator;typedef typename Map::SHalfedge_const_handle    SHalfedge_const_handle;typedef typename Map::SHalfedge_const_iterator  SHalfedge_const_iterator;typedef typename Map::SFace                     SFace;typedef typename Map::SFace_handle              SFace_handle;typedef typename Map::SFace_iterator            SFace_iterator;typedef typename Map::SFace_const_handle        SFace_const_handle;typedef typename Map::SFace_const_iterator      SFace_const_iterator;typedef typename Map::SHalfloop                 SHalfloop;typedef typename Map::SHalfloop_handle          SHalfloop_handle;typedef typename Map::SHalfloop_iterator        SHalfloop_iterator;typedef typename Map::SHalfloop_const_handle    SHalfloop_const_handle;typedef typename Map::SHalfloop_const_iterator  SHalfloop_const_iterator;typedef typename Map::Object_handle             Object_handle;typedef typename Map::SHalfedge_around_svertex_circulator                      SHalfedge_around_svertex_circulator;typedef typename Map::SHalfedge_around_sface_circulator                      SHalfedge_around_sface_circulator;typedef typename Map::SFace_cycle_iterator      SFace_cycle_iterator;/*{\Mtypemember iterating all face cycles of an face |f|.The iterator has method |bool is_svertex()|, |bool is_shalfedge()|,|bool is_shalfloop()|, and can be converted to the correspondinghandles |SVertex_handle|, |SHalfedge_handle|, or |SHalfloop_handle|.}*/protected:   Map* psm_;public:/*{\Mcreation 3}*/SM_decorator() : psm_(0) {}SM_decorator(const Self& D) : psm_(D.psm_) {}Self& operator=(const Self& D) { psm_=D.psm_; return *this; }SM_decorator(Map* M) : psm_(M) {} /*{\Moperations 4 4}*/Map* sphere_map() const { return psm_; }Map* map() { return psm_; }const Map* map() const { return psm_; }SVertex_const_handle source(SHalfedge_const_handle e) const{ return e->source(); }SVertex_const_handle target(SHalfedge_const_handle e) const{ return e->twin()->source(); }SHalfedge_const_handle twin(SHalfedge_const_handle e) const { return e->twin(); }SHalfloop_const_handle twin(SHalfloop_const_handle l) const { return l->twin(); }SVertex_handle source(SHalfedge_handle e) const/*{\Mop returns the source of |e|.}*/{ return e->source(); }SVertex_handle target(SHalfedge_handle e) const/*{\Mop returns the target of |e|.}*/{ return e->twin()->source(); }SHalfedge_handle twin(SHalfedge_handle e) const /*{\Mop returns the twin of |e|.}*/{ return e->twin(); }SHalfloop_handle twin(SHalfloop_handle l) const /*{\Mop returns the twin of |l|.}*/{ return l->twin(); }bool is_isolated(SVertex_const_handle v) const{ return (v->out_sedge() == SHalfedge_handle()); }bool is_isolated(SVertex_handle v) const/*{\Mop returns |true| when |v| is linked to the interior of a face.}*/{ return (v->out_sedge() == SHalfedge_handle()); }SHalfedge_const_handle first_out_edge(SVertex_const_handle v) const{ return v->out_sedge(); }SHalfedge_const_handle last_out_edge(SVertex_const_handle v) const{ return cap(v->out_sedge()); }SHalfedge_handle first_out_edge(SVertex_handle v) const/*{\Mop returns one edge with source |v|. It's the starting point for  the circular iteration over the edges with source |v|.  \precond |!is_isolated(v)|.}*/{ return v->out_sedge(); }SHalfedge_handle last_out_edge(SVertex_handle v) const/*{\Mop returns one edge with source |v|. \precond |!is_isolated(v)|.}*/{ return cap(v->out_sedge()); }SHalfedge_const_handle cyclic_adj_succ(SHalfedge_const_handle e) const{ return e->sprev()->twin(); }SHalfedge_const_handle cyclic_adj_pred(SHalfedge_const_handle e) const{ return e->twin()->snext(); }SHalfedge_handle cyclic_adj_succ(SHalfedge_handle e) const/*{\Mop returns the edge after |e| in the cyclic ordered adjacency list of  |source(e)|.}*/{ return e->sprev()->twin(); }SHalfedge_handle cyclic_adj_pred(SHalfedge_handle e) const/*{\Mop returns the edge before |e| in the cyclic ordered adjacency list of  |source(e)|.}*/{ return e->twin()->snext(); }SHalfedge_const_handle next(SHalfedge_const_handle e) const{ return e->snext(); }SHalfedge_const_handle previous(SHalfedge_const_handle e) const{ return e->sprev(); }SHalfedge_handle next(SHalfedge_handle e) const/*{\Mop returns the next edge in the face cycle containing |e|.}*/{ return e->snext(); }SHalfedge_handle previous(SHalfedge_handle e) const/*{\Mop returns the previous edge in the face cycle containing |e|.}*/{ return e->sprev(); }SFace_const_handle face(SHalfedge_const_handle e) const{ return e->incident_sface(); }SFace_const_handle face(SHalfloop_const_handle l) const{ return l->incident_sface(); }SFace_const_handle face(SVertex_const_handle v) const{ return v->incident_sface(); }SFace_handle face(SHalfedge_handle e) const/*{\Mop returns the face incident to |e|.}*/{ return e->incident_sface(); }SFace_handle face(SHalfloop_handle l) const/*{\Mop returns the face incident to |l|.}*/{ return l->incident_sface(); }SFace_handle face(SVertex_handle v) const/*{\Mop returns the face incident to |v|. \precond |is_isolated(v)|.}*/{ return v->incident_sface(); }bool has_shalfloop() const/*{\Mop returns true iff there is a loop.}*/{ return psm_->has_shalfloop(); }/*{\Mtext \headerline{Iteration} \setopdims{3.3cm}{0cm}}*/  SVertex_iterator svertices_begin() const{ return psm_->svertices_begin(); }SVertex_iterator svertices_end() const{ return psm_->svertices_end(); }SHalfedge_iterator shalfedges_begin() const{ return psm_->shalfedges_begin(); }SHalfedge_iterator shalfedges_end() const{ return psm_->shalfedges_end(); }SFace_iterator sfaces_begin() const{ return psm_->sfaces_begin(); }SFace_iterator sfaces_end() const{ return psm_->sfaces_end(); }SHalfloop_iterator shalfloops_begin() const{ return psm_->shalfloops_begin(); }SHalfloop_iterator shalfloops_end() const{ return psm_->shalfloops_end(); }SHalfloop_handle shalfloop() const{ return psm_->shalfloop(); }Size_type number_of_svertices() const /*{\Mop returns the number of vertices.}*/{ return psm_->number_of_svertices(); }Size_type number_of_shalfedges() const /*{\Mop returns the number of halfedges.}*/{ return psm_->number_of_shalfedges(); }Size_type number_of_sedges() const /*{\Mop returns the number of edges.}*/{ return number_of_shalfedges()/2; }Size_type number_of_shalfloops() const /*{\Mop returns the number of halfloops.}*/{ return psm_->number_of_shalfloops(); }Size_type number_of_sloops() const /*{\Mop returns the number of loops.}*/{ return psm_->number_of_shalfloops()/2; }Size_type number_of_sfaces() const    /*{\Mop returns the number of faces.}*/{ return psm_->number_of_sfaces(); }SFace_cycle_iterator sface_cycles_begin(SFace_handle f) const/*{\Mop returns an iterator for all bounding face cycles of |f|.The iterator is is convertable to |SVertex_handle|, |SHalfloop_handle|, or |SHalfedge_handle|.}*/{ return f->boundary_entry_objects().begin(); }SFace_cycle_iterator sface_cycles_end(SFace_handle f) const/*{\Mop returns the past the end iterator of |f|.}*/{ return f->boundary_entry_objects_.end(); }SHalfedge_around_svertex_circulator   out_edges(SVertex_handle v) const/*{\Mop returns a circulator for the cyclic adjacency list of |v|.\precond the adjacency list is not empty.}*/{ return SHalfedge_around_svertex_circulator(first_out_edge(v)); }/*{\Mtext \headerline{Update Operations}}*/void clear() const/*{\Mop reintializes |P| to the empty map.}*/{ psm_->clear(); }bool is_closed_at_source(SHalfedge_handle e) const/*{\Mop returns |true| when |prev(e) == twin(e)|.}*/{ return previous(e) == twin(e); }bool is_closed_at_target(SHalfedge_handle e) const/*{\Mop returns |true| when |next(e) == twin(e)|.}*/{ return next(e) == twin(e); }SHalfedge_handle cas(SHalfedge_handle e) const { return cyclic_adj_succ(e); } SHalfedge_handle cap(SHalfedge_handle e) const{ return cyclic_adj_pred(e); }template <typename H>void make_twins(H h1, H h2) const{ h1->twin() = h2; h2->twin() = h1; }SVertex_handle new_svertex(const Sphere_point& p = Sphere_point())/*{\Mop creates a new vertex.}*/{ return map()->new_svertex(p); }SHalfedge_handle new_shalfedge_pair() {/*{\Xop creates a new edge pair. No connectivity is provided.}*/  return map()->new_shalfedge_pair();}SHalfloop_handle new_shalfloop_pair()/*{\Mop creates a new loop pair.\precond No sloop pair exists in the local graph.}*/ { CGAL_assertion(!has_shalfloop());  return map()->new_shalfloop_pair(); }SFace_handle new_sface()/*{\Mop creates a new face.}*/{ return map()->new_sface(); }void delete_vertex_only(SVertex_handle v)/*{\Mop deletes |v| without any connectivity update.}*/{ map()->delete_svertex(v); }

⌨️ 快捷键说明

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