snc_structure.h

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

H
1,188
字号
// 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_3/include/CGAL/Nef_3/SNC_structure.h,v $// $Revision: 1.62.2.1 $ $Date: 2004/12/08 19:31:02 $// $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>#ifndef CGAL_SNC_STRUCTURE_H#define CGAL_SNC_STRUCTURE_H#include <CGAL/basic.h>#include <CGAL/Unique_hash_map.h>#include <CGAL/In_place_list.h>#include <CGAL/Nef_S2/Generic_handle_map.h>#include <CGAL/Nef_2/Object_handle.h>#include <CGAL/Nef_3/SNC_iteration.h>#include <CGAL/Nef_2/iterator_tools.h>#include <CGAL/Nef_S2/Sphere_geometry.h>#include <list>#undef CGAL_NEF_DEBUG#define CGAL_NEF_DEBUG 41#include <CGAL/Nef_2/debug.h>#include <CGAL/Nef_2/Object_index.h>CGAL_BEGIN_NAMESPACEtemplate <typename HE>struct move_shalfedge_around_facet {  void forward(HE& e) const { e = (e->next()); }  void backward(HE& e) const { e = (e->prev()); }};template <class Object, class Hash_map, class Union_find>void merge_sets( Object o1, Object o2, Hash_map& hash, Union_find& uf) {  //CGAL_assertion( hash[o1] != 0 && hash[o2] != 0);  CGAL_assertion( hash.is_defined(o1) && hash.is_defined(o2));  if( !uf.same_set( hash[o1], hash[o2]))    uf.unify_sets( hash[o1], hash[o2]);}template <typename K, typename I, typename M> class SNC_sphere_map;template <typename S> class SM_decorator;template <typename S> class SNC_decorator;/*{\Manpage {SNC_structure}{Items}{Selective Nef Complex}{C}}*/template <typename Kernel_, typename Items_, typename Mark_>class SNC_structure {/*{\Mdefinition The extended Wuerzburg structure is the topologicalstructure of Nef polyhedra. It is programmed around the localgraphs of the vertices of a Nef polyhedron, which describe thepoint set completely. All other concepts are either derived fromthe local graph or added for the comfort of the user.}*/public:  /*{\Mtypes 7}*/  typedef Items_                             Items;  typedef Kernel_                            Kernel;  typedef Mark_                              Mark;  typedef SNC_structure<Kernel,Items,Mark>   Self;  //  typedef bool                          Mark;  typedef SNC_decorator<Self>           SNC_decorator;  typedef typename Kernel::FT           FT;  typedef typename Kernel::RT           RT;  typedef CGAL::Sphere_geometry<Kernel> Sphere_kernel;    typedef SNC_sphere_map<Kernel, Items, Mark> Sphere_map;  typedef SM_decorator<Sphere_map>  SM_decorator;  typedef typename Kernel::Point_3      Point_3;  /*{\Mtypemember embedding vertices.}*/  typedef typename Kernel::Plane_3      Plane_3;  /*{\Mtypemember supporting facets.}*/  typedef typename Kernel::Vector_3     Vector_3;  /*{\Mtypemember normal vectors.}*/  typedef typename Kernel::Direction_3  Direction_3;  /*{\Mtypemember normal directions.}*/  typedef typename Kernel::Segment_3    Segment_3;  /*{\Mtypemember segments in space.}*/  typedef typename Kernel::Line_3       Line_3;  /*{\Mtypemember lines in space.}*/  typedef typename Kernel::Ray_3       Ray_3;  /*{\Mtypemember rays in space.}*/  typedef typename Kernel::Triangle_3       Triangle_3;  /*{\Mtypemember triangles in space.}*/  typedef typename Kernel::Aff_transformation_3 Aff_transformation_3;  typedef typename Sphere_kernel::Sphere_point     Sphere_point;  /*{\Mtypemember points on the unit sphere.}*/  typedef typename Sphere_kernel::Sphere_segment   Sphere_segment;  /*{\Mtypemember segments on the unit sphere.}*/  typedef typename Sphere_kernel::Sphere_circle    Sphere_circle;  /*{\Mtypemember segments on the unit sphere.}*/  typedef typename Sphere_kernel::Sphere_direction Sphere_direction;  /*{\Mtypemember directions on the unit sphere.}*/  typedef size_t Size_type;  /*{\Mtypemember size type.}*/ private:  friend class CGAL::SM_decorator<Sphere_map>;  friend class CGAL::SNC_decorator<Self>;  /*{\Mtext For all objects |Vertex|, |Halfedge|, |Halffacet|, |Volume|  there are handle and iterator types |xxx_handle|, |xxx_iterator|.  Additionally all objects of the local graph of a vertex   |SVertex|, |SHalfedge|, |SHalfloop|, |SFace| are accessed via handles  and iterators. There's no type |SHalfloop_iterator|, as there is  at most one |SLoop| pair per vertex.}*/ public:  typedef Sphere_map                                        Vertex_base;  typedef SNC_in_place_list_sm<Vertex_base>                 Vertex;   typedef CGAL::In_place_list<Vertex,false>                 Vertex_list;  typedef CGAL_ALLOCATOR(Vertex)                            Vertex_alloc;  typedef typename Vertex_list::iterator                    Vertex_handle;  typedef typename Vertex_list::const_iterator              Vertex_const_handle;  typedef typename Vertex_list::iterator                    Vertex_iterator;  typedef typename Vertex_list::const_iterator              Vertex_const_iterator;  typedef typename Items::template Halffacet<SNC_structure> Halffacet_base;  typedef SNC_in_place_list_halffacet<Halffacet_base>       Halffacet;  typedef CGAL::In_place_list<Halffacet,false>              Halffacet_list;  typedef CGAL_ALLOCATOR(Halffacet)                         Halffacet_alloc;  typedef typename Halffacet_list::iterator                 Halffacet_handle;  typedef typename Halffacet_list::const_iterator           Halffacet_const_handle;  typedef typename Halffacet_list::iterator                 Halffacet_iterator;  typedef typename Halffacet_list::const_iterator           Halffacet_const_iterator;  typedef typename Items::template Volume<SNC_structure>    Volume_base;  typedef SNC_in_place_list_volume<Volume_base>             Volume;  typedef CGAL::In_place_list<Volume,false>                 Volume_list;  typedef CGAL_ALLOCATOR(Volume)                            Volume_alloc;  typedef typename Volume_list::iterator                    Volume_handle;  typedef typename Volume_list::const_iterator              Volume_const_handle;  typedef typename Volume_list::iterator                    Volume_iterator;  typedef typename Volume_list::const_iterator              Volume_const_iterator;  typedef typename Items::template SVertex<SNC_structure>   SVertex_base;  typedef SNC_in_place_list_svertex<SVertex_base>           SVertex;  typedef CGAL::In_place_list<SVertex,false>                SVertex_list;  typedef CGAL_ALLOCATOR(SVertex)                           SVertex_alloc;  typedef typename SVertex_list::iterator                   SVertex_handle;  typedef typename SVertex_list::const_iterator             SVertex_const_handle;  typedef typename SVertex_list::iterator                   SVertex_iterator;  typedef typename SVertex_list::const_iterator             SVertex_const_iterator;  typedef typename Items::template SVertex<SNC_structure>   Halfedge_base;  typedef SNC_in_place_list_svertex<SVertex_base>           Halfedge;  typedef CGAL::In_place_list<SVertex,false>                Halfedge_list;  typedef CGAL_ALLOCATOR(SVertex)                           Halfedge_alloc;  typedef typename SVertex_list::iterator                   Halfedge_handle;  typedef typename SVertex_list::const_iterator             Halfedge_const_handle;  typedef typename SVertex_list::iterator                   Halfedge_iterator;  typedef typename SVertex_list::const_iterator             Halfedge_const_iterator;  typedef typename Items::template SHalfedge<SNC_structure> SHalfedge_base;  typedef SNC_in_place_list_shalfedge<SHalfedge_base>       SHalfedge;  typedef CGAL::In_place_list<SHalfedge,false>              SHalfedge_list;  typedef CGAL_ALLOCATOR(SHalfedge)                         SHalfedge_alloc;  typedef typename SHalfedge_list::iterator                 SHalfedge_handle;  typedef typename SHalfedge_list::const_iterator           SHalfedge_const_handle;  typedef typename SHalfedge_list::iterator                 SHalfedge_iterator;  typedef typename SHalfedge_list::const_iterator           SHalfedge_const_iterator;  typedef typename Items::template SHalfloop<SNC_structure> SHalfloop_base;  typedef SNC_in_place_list_shalfloop<SHalfloop_base>       SHalfloop;  typedef CGAL::In_place_list<SHalfloop,false>              SHalfloop_list;  typedef CGAL_ALLOCATOR(SHalfloop)                         SHalfloop_alloc;  typedef typename SHalfloop_list::iterator                 SHalfloop_handle;  typedef typename SHalfloop_list::const_iterator           SHalfloop_const_handle;  typedef typename SHalfloop_list::iterator                 SHalfloop_iterator;  typedef typename SHalfloop_list::const_iterator           SHalfloop_const_iterator;  typedef typename Items::template SFace<SNC_structure>     SFace_base;  typedef SNC_in_place_list_sface<SFace_base>               SFace;  typedef CGAL::In_place_list<SFace,false>                  SFace_list;  typedef CGAL_ALLOCATOR(SFace)                             SFace_alloc;  typedef typename SFace_list::iterator                     SFace_handle;  typedef typename SFace_list::const_iterator               SFace_const_handle;  typedef typename SFace_list::iterator                     SFace_iterator;  typedef typename SFace_list::const_iterator               SFace_const_iterator;  typedef CGAL::Object_handle         Object_handle;  typedef std::list<Object_handle>    Object_list;  typedef Object_list::iterator       Object_iterator;  typedef Object_list::const_iterator Object_const_iterator;  typedef Object_list::const_iterator Object_const_handle;  typedef typename Sphere_map::SHalfedge_around_svertex_circulator                               SHalfedge_around_svertex_circulator;  typedef typename Sphere_map::SHalfedge_around_sface_circulator                               SHalfedge_around_sface_circulator;  typedef typename Sphere_map::SHalfedge_around_svertex_const_circulator                               SHalfedge_around_svertex_const_circulator;  typedef typename Sphere_map::SHalfedge_around_sface_const_circulator                               SHalfedge_around_sface_const_circulator;  typedef typename Sphere_map::Infi_box   Infi_box;  typedef typename Infi_box::Standard_kernel  Standard_kernel;  typedef Vertex_handle Constructor_parameter;  typedef Vertex_const_handle Constructor_const_parameter;  // Halffacet triangle  class Halffacet_triangle_handle : public Halffacet_handle {    typedef Halffacet_handle Base;    Triangle_3 triangle;  public:    Halffacet_triangle_handle() : Base() {}    Halffacet_triangle_handle( Halffacet_handle h, Triangle_3 t = Triangle_3()) :      Base(h), triangle(t) {}    Triangle_3 get_triangle() { return triangle; }  };    class Halffacet_cycle_iterator : public Object_iterator   /*{\Mtypemember a generic handle to an object in the boundary  of a facet. Convertible to |Object_handle|.}*/  { typedef Object_iterator Ibase;  public:    Halffacet_cycle_iterator() : Ibase() {}    Halffacet_cycle_iterator(const Ibase& b) : Ibase(b) {}    Halffacet_cycle_iterator(const Halffacet_cycle_iterator& i)       : Ibase(i) {}    bool is_shalfedge() const    { SHalfedge_handle e; return CGAL::assign(e,Ibase::operator*()); }    bool is_shalfloop() const    { SHalfloop_handle l; return CGAL::assign(l,Ibase::operator*()); }    operator SHalfedge_handle() const     { SHalfedge_handle e; CGAL::assign(e,Ibase::operator*()); return e; }    operator SHalfloop_handle() const     { SHalfloop_handle l; CGAL::assign(l,Ibase::operator*()); return l; }    operator Object_handle() const { return Ibase::operator*(); }    Object_handle& operator*() const { return Ibase::operator*(); }    Object_handle  operator->() const       { CGAL_assertion_msg(0,"not impl."); return Object_handle();}  };  class Halffacet_cycle_const_iterator : public Object_const_iterator   /*{\Mtypemember a generic handle to an object in the boundary  of a facet. Convertible to |Object_handle|.}*/  { typedef Object_const_iterator Ibase;  public:    Halffacet_cycle_const_iterator() : Ibase() {}    Halffacet_cycle_const_iterator(const Ibase& b) : Ibase(b) {}    Halffacet_cycle_const_iterator(const Halffacet_cycle_const_iterator& i)       : Ibase(i) {}      bool is_shalfedge() const    { SHalfedge_handle e; return CGAL::assign(e,Ibase::operator*()); }    bool is_shalfloop() const    { SHalfloop_handle l; return CGAL::assign(l,Ibase::operator*()); }    operator SHalfedge_const_handle() const     { SHalfedge_handle e; CGAL::assign(e,Ibase::operator*());       return SHalfedge_const_handle(e); }    operator SHalfloop_const_handle() const     { SHalfloop_handle l; CGAL::assign(l,Ibase::operator*());       return SHalfloop_const_handle(l); }    operator Object_handle() const { return Ibase::operator*(); }    Object_handle& operator*() const { return Ibase::operator*(); }    Object_handle  operator->() const     { CGAL_assertion_msg(0,"not impl."); return Object_handle();}  };  class SFace_cycle_iterator : public Object_iterator   /*{\Mtypemember a generic iterator to an object in the boundary  of a sface. Convertible to |Object_handle|.}*/  { typedef Object_iterator Ibase;  public:    SFace_cycle_iterator() : Ibase() {}    SFace_cycle_iterator(const Ibase& b) : Ibase(b) {}    SFace_cycle_iterator(const SFace_cycle_iterator& i) : Ibase(i) {}      bool is_svertex() const     { SVertex_handle v; return CGAL::assign(v,Ibase::operator*()); }    bool is_shalfedge() const    { SHalfedge_handle e; return CGAL::assign(e,Ibase::operator*()); }    bool is_shalfloop() const    { SHalfloop_handle l; return CGAL::assign(l,Ibase::operator*()); }    operator SVertex_handle() const     { SVertex_handle v; CGAL::assign(v,Ibase::operator*()); return v; }    operator SHalfedge_handle() const     { SHalfedge_handle e; CGAL::assign(e,Ibase::operator*()); return e; }    operator SHalfloop_handle() const     { SHalfloop_handle l; CGAL::assign(l,Ibase::operator*()); return l; }    operator Object_handle() const { return Ibase::operator*(); }    Object_handle& operator*() const { return Ibase::operator*(); }    Object_handle  operator->() const     { this->CGAL_nef_assertion_msg(0,"not impl."); return Object_handle(); }  };  class SFace_cycle_const_iterator : public Object_const_iterator   /*{\Mtypemember a generic iterator to an object in the boundary  of a facet. Convertible to |Object_handle|.}*/  { typedef Object_const_iterator Ibase;  public:    SFace_cycle_const_iterator() : Ibase() {}    SFace_cycle_const_iterator(const Ibase& b) : Ibase(b) {}    SFace_cycle_const_iterator(const SFace_cycle_const_iterator& i)       : Ibase(i) {}      bool is_svertex() const     { SVertex_handle v; return CGAL::assign(v,Ibase::operator*()); }    bool is_shalfedge() const    { SHalfedge_handle e; return CGAL::assign(e,Ibase::operator*()); }    bool is_shalfloop() const    { SHalfloop_handle l; return CGAL::assign(l,Ibase::operator*()); }    operator SVertex_const_handle() const     { SVertex_handle v; CGAL::assign(v,Ibase::operator*());       return SVertex_const_handle(v); }    operator SHalfedge_const_handle() const     { SHalfedge_handle e; CGAL::assign(e,Ibase::operator*());       return SHalfedge_const_handle(e); }    operator SHalfloop_const_handle() const     { SHalfloop_handle l; CGAL::assign(l,Ibase::operator*());       return SHalfloop_const_handle(l); }    operator Object_handle() const { return Ibase::operator*(); }    const Object_handle& operator*() const { return Ibase::operator*(); }    Object_handle  operator->() const     { this->CGAL_nef_assertion_msg(0,"not impl."); return Object_handle(); }  };  class Shell_entry_iterator : public Object_iterator   /*{\Mtypemember a generic iterator to an object in the boundary  of a shell. Convertible to |SFace_handle|.}*/  { typedef Object_iterator Ibase;   public:    Shell_entry_iterator() : Ibase() {}    Shell_entry_iterator(const Ibase& b) : Ibase(b) {}    Shell_entry_iterator(const Shell_entry_iterator& i) : Ibase(i) {}      operator SFace_handle() const     { SFace_handle f;       CGAL_assertion( CGAL::assign(f,Ibase::operator*()) );      CGAL::assign(f,Ibase::operator*()); return f; }    operator Object_handle() const { return Ibase::operator*(); }    Object_handle& operator*() const { return Ibase::operator*(); }    Object_handle  operator->() const     { this->CGAL_nef_assertion_msg(0,"not impl."); return Object_handle(); }  };  class Shell_entry_const_iterator : public Object_const_iterator   { typedef Object_const_iterator Ibase;   public:    Shell_entry_const_iterator() : Ibase() {}    Shell_entry_const_iterator(const Ibase& b) : Ibase(b) {}    Shell_entry_const_iterator(const Shell_entry_const_iterator& i) :      Ibase(i) {}      operator SFace_const_handle() const     { SFace_handle f;       CGAL_assertion( CGAL::assign(f,Ibase::operator*()) );      CGAL::assign(f,Ibase::operator*());       return SFace_const_handle(f); }    operator Object_handle() const { return Ibase::operator*(); }    Object_handle& operator*() const { return Ibase::operator*(); }    Object_handle  operator->() const     { this->CGAL_nef_assertion_msg(0,"not impl."); return Object_handle(); }  };  typedef CircFromIt<SHalfedge_const_iterator,           move_shalfedge_around_facet<SHalfedge_const_iterator> >           SHalfedge_around_facet_const_circulator;  // Mutable Circulators:   typedef CircFromIt<SHalfedge_iterator,           move_shalfedge_around_facet<SHalfedge_iterator> >           SHalfedge_around_facet_circulator;

⌨️ 快捷键说明

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