📄 circulatorst.hh
字号:
typedef const Mesh& mesh_ref; typedef const Mesh* mesh_ptr; typedef const typename Mesh::Vertex& reference; typedef const typename Mesh::Vertex* pointer;#else typedef Mesh& mesh_ref; typedef Mesh* mesh_ptr; typedef typename Mesh::Vertex& reference; typedef typename Mesh::Vertex* pointer;#endif /// Default constructor ConstFaceVertexIterT() : mesh_(0), active_(false) {} /// Construct with mesh and a typename Mesh::FaceHandle ConstFaceVertexIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) : mesh_(&_mesh), start_(_mesh.halfedge_handle(_start)), heh_(start_), active_(false) { ; } /// Construct with mesh and start halfedge ConstFaceVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) : mesh_(&_mesh), start_(_heh), heh_(_heh), active_(false) { ; } /// Copy constructor ConstFaceVertexIterT(const ConstFaceVertexIterT& _rhs) : mesh_(_rhs.mesh_), start_(_rhs.start_), heh_(_rhs.heh_), active_(_rhs.active_) { ; } /// Assignment operator ConstFaceVertexIterT& operator=(const ConstFaceVertexIterT<Mesh>& _rhs) { mesh_ = _rhs.mesh_; start_ = _rhs.start_; heh_ = _rhs.heh_; active_ = _rhs.active_; return *this; }#if 1 /// construct from non-const circulator type ConstFaceVertexIterT(const FaceVertexIterT<Mesh>& _rhs) : mesh_(_rhs.mesh_), start_(_rhs.start_), heh_(_rhs.heh_), active_(_rhs.active_) { ; } /// assign from non-const circulator ConstFaceVertexIterT& operator=(const FaceVertexIterT<Mesh>& _rhs) { mesh_ = _rhs.mesh_; start_ = _rhs.start_; heh_ = _rhs.heh_; active_ = _rhs.active_; return *this; }#else friend class ConstFaceVertexIterT<Mesh>;#endif /// Equal ? bool operator==(const ConstFaceVertexIterT& _rhs) const { return ((mesh_ == _rhs.mesh_) && (start_ == _rhs.start_) && (heh_ == _rhs.heh_) && (active_ == _rhs.active_)); } /// Not equal ? bool operator!=(const ConstFaceVertexIterT& _rhs) const { return !operator==(_rhs); } /// Pre-Increment (next ccw target) ConstFaceVertexIterT& operator++() { assert(mesh_); active_ = true; heh_=mesh_->next_halfedge_handle(heh_);; return *this; } /// Pre-Decrement (next cw target) ConstFaceVertexIterT& operator--() { assert(mesh_); active_ = true; heh_=mesh_->prev_halfedge_handle(heh_);; return *this; } /** Get the current halfedge. There are \c Vertex*Iters and \c Face*Iters. For both the current state is defined by the current halfedge. This is what this method returns. */ HalfedgeHandle current_halfedge_handle() const { return heh_; } /// Return the handle of the current target. typename Mesh::VertexHandle handle() const { assert(mesh_); return mesh_->to_vertex_handle(heh_); } /// Cast to the handle of the current target. operator typename Mesh::VertexHandle() const { assert(mesh_); return mesh_->to_vertex_handle(heh_); } /// Return a reference to the current target. reference operator*() const { assert(mesh_); return mesh_->deref(handle()); } /// Return a pointer to the current target. pointer operator->() const { assert(mesh_); return &mesh_->deref(handle()); } /** Returns whether the circulator is still valid. After one complete round around a vertex/face the circulator becomes invalid, i.e. this function will return \c false. Nevertheless you can continue circulating. This method just tells you whether you have completed the first round. */ operator bool() const { return heh_.is_valid() && ((start_ != heh_) || (!active_)); }private: mesh_ptr mesh_; HalfedgeHandle start_, heh_; bool active_;};//== CLASS DEFINITION ========================================================= /** \class FaceHalfedgeIterT CirculatorsT.hh <OpenMesh/Mesh/Iterators/CirculatorsT.hh> Circulator.*/template <class Mesh>class FaceHalfedgeIterT{ public: //--- Typedefs --- typedef typename Mesh::HalfedgeHandle HalfedgeHandle; typedef typename Mesh::Halfedge value_type; typedef typename Mesh::HalfedgeHandle value_handle;#if 0 typedef const Mesh& mesh_ref; typedef const Mesh* mesh_ptr; typedef const typename Mesh::Halfedge& reference; typedef const typename Mesh::Halfedge* pointer;#else typedef Mesh& mesh_ref; typedef Mesh* mesh_ptr; typedef typename Mesh::Halfedge& reference; typedef typename Mesh::Halfedge* pointer;#endif /// Default constructor FaceHalfedgeIterT() : mesh_(0), active_(false) {} /// Construct with mesh and a typename Mesh::FaceHandle FaceHalfedgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) : mesh_(&_mesh), start_(_mesh.halfedge_handle(_start)), heh_(start_), active_(false) { ; } /// Construct with mesh and start halfedge FaceHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) : mesh_(&_mesh), start_(_heh), heh_(_heh), active_(false) { ; } /// Copy constructor FaceHalfedgeIterT(const FaceHalfedgeIterT& _rhs) : mesh_(_rhs.mesh_), start_(_rhs.start_), heh_(_rhs.heh_), active_(_rhs.active_) { ; } /// Assignment operator FaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs) { mesh_ = _rhs.mesh_; start_ = _rhs.start_; heh_ = _rhs.heh_; active_ = _rhs.active_; return *this; }#if 0 /// construct from non-const circulator type FaceHalfedgeIterT(const FaceHalfedgeIterT<Mesh>& _rhs) : mesh_(_rhs.mesh_), start_(_rhs.start_), heh_(_rhs.heh_), active_(_rhs.active_) { ; } /// assign from non-const circulator FaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs) { mesh_ = _rhs.mesh_; start_ = _rhs.start_; heh_ = _rhs.heh_; active_ = _rhs.active_; return *this; }#else friend class ConstFaceHalfedgeIterT<Mesh>;#endif /// Equal ? bool operator==(const FaceHalfedgeIterT& _rhs) const { return ((mesh_ == _rhs.mesh_) && (start_ == _rhs.start_) && (heh_ == _rhs.heh_) && (active_ == _rhs.active_)); } /// Not equal ? bool operator!=(const FaceHalfedgeIterT& _rhs) const { return !operator==(_rhs); } /// Pre-Increment (next cw target) FaceHalfedgeIterT& operator++() { assert(mesh_); active_ = true; heh_=mesh_->next_halfedge_handle(heh_);; return *this; } /// Pre-Decrement (next ccw target) FaceHalfedgeIterT& operator--() { assert(mesh_); active_ = true; heh_=mesh_->prev_halfedge_handle(heh_);; return *this; } /** Get the current halfedge. There are \c Vertex*Iters and \c Face*Iters. For both the current state is defined by the current halfedge. This is what this method returns. */ HalfedgeHandle current_halfedge_handle() const { return heh_; } /// Return the handle of the current target. typename Mesh::HalfedgeHandle handle() const { assert(mesh_); return heh_; } /// Cast to the handle of the current target. operator typename Mesh::HalfedgeHandle() const { assert(mesh_); return heh_; } /// Return a reference to the current target. reference operator*() const { assert(mesh_); return mesh_->deref(handle()); } /// Return a pointer to the current target. pointer operator->() const { assert(mesh_); return &mesh_->deref(handle()); } /** Returns whether the circulator is still valid. After one complete round around a vertex/face the circulator becomes invalid, i.e. this function will return \c false. Nevertheless you can continue circulating. This method just tells you whether you have completed the first round. */ operator bool() const { return heh_.is_valid() && ((start_ != heh_) || (!active_)); }private: mesh_ptr mesh_; HalfedgeHandle start_, heh_; bool active_;};//== CLASS DEFINITION ========================================================= /** \class ConstFaceHalfedgeIterT CirculatorsT.hh <OpenMesh/Mesh/Iterators/CirculatorsT.hh> Circulator.*/template <class Mesh>class ConstFaceHalfedgeIterT{ public: //--- Typedefs --- typedef typename Mesh::HalfedgeHandle HalfedgeHandle; typedef typename Mesh::Halfedge value_type; typedef typename Mesh::HalfedgeHandle value_handle;#if 1 typedef const Mesh& mesh_ref; typedef const Mesh* mesh_ptr; typedef const typename Mesh::Halfedge& reference; typedef const typename Mesh::Halfedge* pointer;#else typedef Mesh& mesh_ref; typedef Mesh* mesh_ptr; typedef typename Mesh::Halfedge& reference; typedef typename Mesh::Halfedge* pointer;#endif /// Default constructor ConstFaceHalfedgeIterT() : mesh_(0), active_(false) {} /// Construct with mesh and a typename Mesh::FaceHandle ConstFaceHalfedgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) : mesh_(&_mesh), start_(_mesh.halfedge_handle(_start)), heh_(start_), active_(false) { ; } /// Construct with mesh and start halfedge ConstFaceHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) : mesh_(&_mesh), start_(_heh), heh_(_heh), active_(false) { ; } /// Copy constructor ConstFaceHalfedgeIterT(const ConstFaceHalfedgeIterT& _rhs) : mesh_(_rhs.mesh_), start_(_rhs.start_), heh_(_rhs.heh_), active_(_rhs.active_) { ; } /// Assignment operator ConstFaceHalfedgeIterT& operator=(const ConstFaceHalfedgeIterT<Mesh>& _rhs) { mesh_ = _rhs.mesh_; start_ = _rhs.start_; heh_ = _rhs.heh_; active_ = _rhs.active_; return *this; }#if 1 /// construct from non-const circulator type ConstFaceHalfedgeIterT(const FaceHalfedgeIterT<Mesh>& _rhs) : mesh_(_rhs.mesh_), start_(_rhs.start_), heh_(_rhs.heh_), active_(_rhs.active_) { ; } /// assign from non-const circulator ConstFaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs) { mesh_ = _rhs.mesh_; start_ = _rhs.start_; heh_ = _rhs.heh_; active_ = _rhs.active_; return *this; }#else friend class ConstFaceHalfedgeIterT<Mesh>;#endif /// Equal ? bool operator==(const ConstFaceHalfedgeIterT& _rhs) const { return ((mesh_ == _rhs.mesh_) && (start_ == _rhs.start_) && (heh_ == _rhs.heh_) && (active_ == _rhs.active_)); } /// Not equal ? bool operator!=(const ConstFaceHalfedgeIterT& _rhs) const { return !operator==(_rhs); } /// Pre-Increment (next cw target) ConstFaceHalfedgeIterT& operator++() { assert(mesh_); active_ = true; heh_=mesh_->next_halfedge_handle(heh_);; return *this; } /// Pre-Decrement (next ccw target) ConstFaceHalfedgeIterT& operator--() { assert(mesh_); active_ = true; heh_=mesh_->prev_halfedge_handle(heh_);; return *this; } /** Get the current halfedge. There are \c Vertex*Iters and \c Face*Iters. For both the current state is defined by the current halfedge. This is what this method returns. */ HalfedgeHandle current_halfedge_handle() const { return heh_; } /// Return the handle of the current target. typename Mesh::HalfedgeHandle handle() const { assert(mesh_); return heh_; } /// Cast to the handle of the current target. operator typename Mesh::HalfedgeHandle() const { assert(mesh_); return heh_; } /// Return a reference to the current target. reference operator*() const { assert(mesh_); return mesh_->deref(handle()); } /// Return a pointer to the current target. pointer operator->() const { assert(mesh_); return &mesh_->deref(handle()); } /** Returns whether the circulator is still valid. After one complete round around a vertex/face the circulator becomes invalid, i.e. this function will return \c false. Nevertheless you can continue circulating. This method just tells you whether you have completed the first round. */ operator bool() const { return heh_.is_valid() && ((start_ != heh_) || (!active_)); }private: mesh_ptr mesh_; Half
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -