📄 snc_sphere_map.h
字号:
// Copyright (c) 1997-2000 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.//// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.3-branch/Nef_3/include/CGAL/Nef_3/SNC_sphere_map.h $// $Id: SNC_sphere_map.h 29399 2006-03-11 18:34:06Z glisse $// //// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>// Peter Hachenberger <hachenberger@mpi-sb.mpg.de>#ifndef CGAL_SNC_SPHERE_MAP_H#define CGAL_SNC_SPHERE_MAP_H#include <CGAL/basic.h>#include <CGAL/Unique_hash_map.h>#include <CGAL/Nef_2/Object_handle.h>#include <CGAL/Nef_S2/SM_iteration.h>#include <CGAL/Nef_S2/Generic_handle_map.h>#include <CGAL/Nef_2/iterator_tools.h>#include <CGAL/Nef_3/Infimaximal_box.h>#include <CGAL/Nef_S2/Sphere_geometry.h>#include <list>#undef CGAL_NEF_DEBUG#define CGAL_NEF_DEBUG 109#include <CGAL/Nef_2/debug.h>CGAL_BEGIN_NAMESPACEtemplate <typename K, typename I, typename M> class SNC_structure;template <typename HE>struct move_shalfedge_around_svertex { void forward(HE& e) const { e = (e->sprev()->twin()); } void backward(HE& e) const { e = (e->twin()->snext()); }};template <typename HE>struct move_shalfedge_around_sface { void forward(HE& e) const { e = (e->snext()); } void backward(HE& e) const { e = (e->sprev()); }};template <typename Kernel_, typename Items_, typename Mark_>class SNC_sphere_map : public Items_::template Vertex<SNC_structure<Kernel_, Items_, Mark_> >{ public: /*{\Mtypes 7}*/ typedef SNC_sphere_map<Kernel_, Items_,Mark_> Self; typedef Items_ Items; typedef Kernel_ Kernel; typedef Mark_ Mark; typedef CGAL::SNC_structure<Kernel,Items,Mark> SNC_structure; typedef typename Items::template Vertex<SNC_structure> Base; // typedef bool Mark; typedef CGAL::Sphere_geometry<Kernel> Sphere_kernel; 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.}*/ typedef Infimaximal_box<typename Is_extended_kernel<Kernel>::value_type, Kernel> Infi_box; typedef typename Infi_box::Standard_kernel Standard_kernel; typedef Infimaximal_box<typename Is_extended_kernel<Standard_kernel>::value_type, Standard_kernel> No_box; typedef Self 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 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 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 Vertex_handle Constructor_parameter; typedef Vertex_const_handle Constructor_const_parameter; public: SNC_sphere_map(bool construct=false) : Base(), destruct(construct) { if(!construct) return; this->sncp() = new SNC_structure; init_range(this->sncp()->svertices_end()); init_range(this->sncp()->shalfedges_end()); init_range(this->sncp()->sfaces_end()); this->shalfloop() = this->sncp()->shalfloops_end(); } ~SNC_sphere_map() { if(destruct) delete this->sncp(); } SNC_sphere_map(const Base& v) : Base(v), destruct(false) {} SNC_sphere_map(const Self& M) : Base((Base) M), destruct(M.destruct) {} Self& operator=(const Self& M) { destruct = M.destruct; Base* b(this); *b = M; return *this; } void clear(bool clear_base=false) { if(clear_base) Base::clear(); } template <typename H> bool is_sm_boundary_object(H h) const { return this->sncp()->is_sm_boundary_object(h); } template <typename H> Object_iterator& sm_boundary_item(H h) { return this->sncp()->sm_boundary_item(h); } template <typename H> void store_sm_boundary_item(H h, Object_iterator o) { this->sncp()->store_sm_boundary_item(h,o); } template <typename H> void undef_sm_boundary_item(H h) { this->sncp()->undef_sm_boundary_item(h); } void reset_sm_iterator_hash(Object_iterator it) { SVertex_handle sv; SHalfedge_handle se; SHalfloop_handle sl; if ( CGAL::assign(se,*it) ) { if( is_sm_boundary_object(se)) undef_sm_boundary_item(se); return; } if ( CGAL::assign(sl,*it) ) { if( is_sm_boundary_object(sl)) undef_sm_boundary_item(sl); return; } if ( CGAL::assign(sv,*it) ) { if( is_sm_boundary_object(sv)) undef_sm_boundary_item(sv); return; } } void reset_sm_object_list(Object_list& L) { Object_iterator oit; CGAL_forall_iterators(oit,L) reset_sm_iterator_hash(oit); L.clear(); } 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; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -