Point Cloud Library (PCL)  1.7.1
mesh_circulators.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2009-2012, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  * $Id$
38  *
39  */
40 
41 // NOTE: This file has been created with 'pcl_src/geometry/include/pcl/geometry/mesh_circulators.py'
42 
43 #ifndef PCL_GEOMETRY_MESH_CIRCULATORS_H
44 #define PCL_GEOMETRY_MESH_CIRCULATORS_H
45 
46 #include <pcl/geometry/boost.h>
47 #include <pcl/geometry/mesh_indices.h>
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 // VertexAroundVertexCirculator
51 ////////////////////////////////////////////////////////////////////////////////
52 
53 namespace pcl
54 {
55  namespace geometry
56  {
57  /** \brief Circulates counter-clockwise around a vertex and returns an index to the terminating vertex of the outgoing half-edge (the target). The best way to declare the circulator is to use the method pcl::geometry::MeshBase::getVertexAroundVertexCirculator ().
58  * \tparam MeshT Mesh to which this circulator belongs to.
59  * \note The circulator can't be used to change the connectivity in the mesh (only const circulators are valid).
60  * \author Martin Saelzle
61  * \ingroup geometry
62  */
63  template <class MeshT>
65  : boost::equality_comparable <pcl::geometry::VertexAroundVertexCirculator <MeshT>
66  , boost::unit_steppable <pcl::geometry::VertexAroundVertexCirculator <MeshT>
67  > >
68  {
69  public:
70 
71  typedef boost::equality_comparable <pcl::geometry::VertexAroundVertexCirculator <MeshT>
72  , boost::unit_steppable <pcl::geometry::VertexAroundVertexCirculator <MeshT> > > Base;
74 
75  typedef MeshT Mesh;
76  typedef typename Mesh::VertexIndex VertexIndex;
77  typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
78 
79  /** \brief Constructor resulting in an invalid circulator. */
81  : mesh_ (NULL),
83  {
84  }
85 
86  /** \brief Construct from the vertex around which we want to circulate. */
88  Mesh*const mesh)
89  : mesh_ (mesh),
90  idx_outgoing_half_edge_ (mesh->getOutgoingHalfEdgeIndex (idx_vertex))
91  {
92  }
93 
94  /** \brief Construct directly from the outgoing half-edge. */
95  VertexAroundVertexCirculator (const HalfEdgeIndex& idx_outgoing_half_edge,
96  Mesh*const mesh)
97  : mesh_ (mesh),
98  idx_outgoing_half_edge_ (idx_outgoing_half_edge)
99  {
100  }
101 
102  /** \brief Check if the circulator is valid.
103  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure this yourself when constructing the circulator. */
104  inline bool
105  isValid () const
106  {
107  return (idx_outgoing_half_edge_.isValid ());
108  }
109 
110  /** \brief Comparison operators (with boost::operators): == !=
111  * \warning Does NOT check if the circulators belong to the same mesh. Please check this yourself. */
112  inline bool
113  operator == (const Self& other) const
114  {
116  }
117 
118  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
119  inline Self&
121  {
122  idx_outgoing_half_edge_ = mesh_->getNextHalfEdgeIndex (mesh_->getOppositeHalfEdgeIndex (idx_outgoing_half_edge_));
123  return (*this);
124  }
125 
126  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
127  inline Self&
129  {
130  idx_outgoing_half_edge_ = mesh_->getOppositeHalfEdgeIndex (mesh_->getPrevHalfEdgeIndex (idx_outgoing_half_edge_));
131  return (*this);
132  }
133 
134  /** \brief Get the index to the target vertex. */
135  inline VertexIndex
136  getTargetIndex () const
137  {
138  return (mesh_->getTerminatingVertexIndex (idx_outgoing_half_edge_));
139  }
140 
141  /** \brief Get the half-edge that is currently stored in the circulator. */
142  inline HalfEdgeIndex
144  {
145  return (idx_outgoing_half_edge_);
146  }
147 
148  /** \brief The mesh to which this circulator belongs to. */
150 
151  /** \brief The outgoing half-edge of the vertex around which we want to circulate. */
153  };
154  } // End namespace geometry
155 } // End namespace pcl
156 
157 ////////////////////////////////////////////////////////////////////////////////
158 // OutgoingHalfEdgeAroundVertexCirculator
159 ////////////////////////////////////////////////////////////////////////////////
160 
161 namespace pcl
162 {
163  namespace geometry
164  {
165  /** \brief Circulates counter-clockwise around a vertex and returns an index to the outgoing half-edge (the target). The best way to declare the circulator is to use the method pcl::geometry::MeshBase::getOutgoingHalfEdgeAroundVertexCirculator ().
166  * \tparam MeshT Mesh to which this circulator belongs to.
167  * \note The circulator can't be used to change the connectivity in the mesh (only const circulators are valid).
168  * \author Martin Saelzle
169  * \ingroup geometry
170  */
171  template <class MeshT>
173  : boost::equality_comparable <pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator <MeshT>
174  , boost::unit_steppable <pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator <MeshT>
175  > >
176  {
177  public:
178 
179  typedef boost::equality_comparable <pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator <MeshT>
180  , boost::unit_steppable <pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator <MeshT> > > Base;
182 
183  typedef MeshT Mesh;
184  typedef typename Mesh::VertexIndex VertexIndex;
185  typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
186 
187  /** \brief Constructor resulting in an invalid circulator. */
189  : mesh_ (NULL),
191  {
192  }
193 
194  /** \brief Construct from the vertex around which we want to circulate. */
196  Mesh*const mesh)
197  : mesh_ (mesh),
198  idx_outgoing_half_edge_ (mesh->getOutgoingHalfEdgeIndex (idx_vertex))
199  {
200  }
201 
202  /** \brief Construct directly from the outgoing half-edge. */
204  Mesh*const mesh)
205  : mesh_ (mesh),
206  idx_outgoing_half_edge_ (idx_outgoing_half_edge)
207  {
208  }
209 
210  /** \brief Check if the circulator is valid.
211  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure this yourself when constructing the circulator. */
212  inline bool
213  isValid () const
214  {
215  return (idx_outgoing_half_edge_.isValid ());
216  }
217 
218  /** \brief Comparison operators (with boost::operators): == !=
219  * \warning Does NOT check if the circulators belong to the same mesh. Please check this yourself. */
220  inline bool
221  operator == (const Self& other) const
222  {
224  }
225 
226  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
227  inline Self&
229  {
230  idx_outgoing_half_edge_ = mesh_->getNextHalfEdgeIndex (mesh_->getOppositeHalfEdgeIndex (idx_outgoing_half_edge_));
231  return (*this);
232  }
233 
234  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
235  inline Self&
237  {
238  idx_outgoing_half_edge_ = mesh_->getOppositeHalfEdgeIndex (mesh_->getPrevHalfEdgeIndex (idx_outgoing_half_edge_));
239  return (*this);
240  }
241 
242  /** \brief Get the index to the outgoing half-edge. */
243  inline HalfEdgeIndex
244  getTargetIndex () const
245  {
246  return (idx_outgoing_half_edge_);
247  }
248 
249  /** \brief Get the half-edge that is currently stored in the circulator. */
250  inline HalfEdgeIndex
252  {
253  return (idx_outgoing_half_edge_);
254  }
255 
256  /** \brief The mesh to which this circulator belongs to. */
258 
259  /** \brief The outgoing half-edge of the vertex around which we want to circulate. */
261  };
262  } // End namespace geometry
263 } // End namespace pcl
264 
265 ////////////////////////////////////////////////////////////////////////////////
266 // IncomingHalfEdgeAroundVertexCirculator
267 ////////////////////////////////////////////////////////////////////////////////
268 
269 namespace pcl
270 {
271  namespace geometry
272  {
273  /** \brief Circulates counter-clockwise around a vertex and returns an index to the incoming half-edge (the target). The best way to declare the circulator is to use the method pcl::geometry::MeshBase::getIncomingHalfEdgeAroundVertexCirculator ().
274  * \tparam MeshT Mesh to which this circulator belongs to.
275  * \note The circulator can't be used to change the connectivity in the mesh (only const circulators are valid).
276  * \author Martin Saelzle
277  * \ingroup geometry
278  */
279  template <class MeshT>
281  : boost::equality_comparable <pcl::geometry::IncomingHalfEdgeAroundVertexCirculator <MeshT>
282  , boost::unit_steppable <pcl::geometry::IncomingHalfEdgeAroundVertexCirculator <MeshT>
283  > >
284  {
285  public:
286 
287  typedef boost::equality_comparable <pcl::geometry::IncomingHalfEdgeAroundVertexCirculator <MeshT>
288  , boost::unit_steppable <pcl::geometry::IncomingHalfEdgeAroundVertexCirculator <MeshT> > > Base;
290 
291  typedef MeshT Mesh;
292  typedef typename Mesh::VertexIndex VertexIndex;
293  typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
294 
295  /** \brief Constructor resulting in an invalid circulator. */
297  : mesh_ (NULL),
299  {
300  }
301 
302  /** \brief Construct from the vertex around which we want to circulate. */
304  Mesh*const mesh)
305  : mesh_ (mesh),
306  idx_incoming_half_edge_ (mesh->getIncomingHalfEdgeIndex (idx_vertex))
307  {
308  }
309 
310  /** \brief Construct directly from the incoming half-edge. */
312  Mesh*const mesh)
313  : mesh_ (mesh),
314  idx_incoming_half_edge_ (idx_incoming_half_edge)
315  {
316  }
317 
318  /** \brief Check if the circulator is valid.
319  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure this yourself when constructing the circulator. */
320  inline bool
321  isValid () const
322  {
323  return (idx_incoming_half_edge_.isValid ());
324  }
325 
326  /** \brief Comparison operators (with boost::operators): == !=
327  * \warning Does NOT check if the circulators belong to the same mesh. Please check this yourself. */
328  inline bool
329  operator == (const Self& other) const
330  {
332  }
333 
334  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
335  inline Self&
337  {
338  idx_incoming_half_edge_ = mesh_->getOppositeHalfEdgeIndex (mesh_->getNextHalfEdgeIndex (idx_incoming_half_edge_));
339  return (*this);
340  }
341 
342  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
343  inline Self&
345  {
346  idx_incoming_half_edge_ = mesh_->getPrevHalfEdgeIndex (mesh_->getOppositeHalfEdgeIndex (idx_incoming_half_edge_));
347  return (*this);
348  }
349 
350  /** \brief Get the index to the incoming half-edge. */
351  inline HalfEdgeIndex
352  getTargetIndex () const
353  {
354  return (idx_incoming_half_edge_);
355  }
356 
357  /** \brief Get the half-edge that is currently stored in the circulator. */
358  inline HalfEdgeIndex
360  {
361  return (idx_incoming_half_edge_);
362  }
363 
364  /** \brief The mesh to which this circulator belongs to. */
366 
367  /** \brief The incoming half-edge of the vertex around which we want to circulate. */
369  };
370  } // End namespace geometry
371 } // End namespace pcl
372 
373 ////////////////////////////////////////////////////////////////////////////////
374 // FaceAroundVertexCirculator
375 ////////////////////////////////////////////////////////////////////////////////
376 
377 namespace pcl
378 {
379  namespace geometry
380  {
381  /** \brief Circulates counter-clockwise around a vertex and returns an index to the face of the outgoing half-edge (the target). The best way to declare the circulator is to use the method pcl::geometry::MeshBase::getFaceAroundVertexCirculator ().
382  * \tparam MeshT Mesh to which this circulator belongs to.
383  * \note The circulator can't be used to change the connectivity in the mesh (only const circulators are valid).
384  * \author Martin Saelzle
385  * \ingroup geometry
386  */
387  template <class MeshT>
389  : boost::equality_comparable <pcl::geometry::FaceAroundVertexCirculator <MeshT>
390  , boost::unit_steppable <pcl::geometry::FaceAroundVertexCirculator <MeshT>
391  > >
392  {
393  public:
394 
395  typedef boost::equality_comparable <pcl::geometry::FaceAroundVertexCirculator <MeshT>
396  , boost::unit_steppable <pcl::geometry::FaceAroundVertexCirculator <MeshT> > > Base;
398 
399  typedef MeshT Mesh;
400  typedef typename Mesh::FaceIndex FaceIndex;
401  typedef typename Mesh::VertexIndex VertexIndex;
402  typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
403 
404  /** \brief Constructor resulting in an invalid circulator. */
406  : mesh_ (NULL),
408  {
409  }
410 
411  /** \brief Construct from the vertex around which we want to circulate. */
413  Mesh*const mesh)
414  : mesh_ (mesh),
415  idx_outgoing_half_edge_ (mesh->getOutgoingHalfEdgeIndex (idx_vertex))
416  {
417  }
418 
419  /** \brief Construct directly from the outgoing half-edge. */
420  FaceAroundVertexCirculator (const HalfEdgeIndex& idx_outgoing_half_edge,
421  Mesh*const mesh)
422  : mesh_ (mesh),
423  idx_outgoing_half_edge_ (idx_outgoing_half_edge)
424  {
425  }
426 
427  /** \brief Check if the circulator is valid.
428  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure this yourself when constructing the circulator. */
429  inline bool
430  isValid () const
431  {
432  return (idx_outgoing_half_edge_.isValid ());
433  }
434 
435  /** \brief Comparison operators (with boost::operators): == !=
436  * \warning Does NOT check if the circulators belong to the same mesh. Please check this yourself. */
437  inline bool
438  operator == (const Self& other) const
439  {
441  }
442 
443  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
444  inline Self&
446  {
447  idx_outgoing_half_edge_ = mesh_->getNextHalfEdgeIndex (mesh_->getOppositeHalfEdgeIndex (idx_outgoing_half_edge_));
448  return (*this);
449  }
450 
451  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
452  inline Self&
454  {
455  idx_outgoing_half_edge_ = mesh_->getOppositeHalfEdgeIndex (mesh_->getPrevHalfEdgeIndex (idx_outgoing_half_edge_));
456  return (*this);
457  }
458 
459  /** \brief Get the index to the target face. */
460  inline FaceIndex
461  getTargetIndex () const
462  {
463  return (mesh_->getFaceIndex (idx_outgoing_half_edge_));
464  }
465 
466  /** \brief Get the half-edge that is currently stored in the circulator. */
467  inline HalfEdgeIndex
469  {
470  return (idx_outgoing_half_edge_);
471  }
472 
473  /** \brief The mesh to which this circulator belongs to. */
475 
476  /** \brief The outgoing half-edge of the vertex around which we want to circulate. */
478  };
479  } // End namespace geometry
480 } // End namespace pcl
481 
482 ////////////////////////////////////////////////////////////////////////////////
483 // VertexAroundFaceCirculator
484 ////////////////////////////////////////////////////////////////////////////////
485 
486 namespace pcl
487 {
488  namespace geometry
489  {
490  /** \brief Circulates clockwise around a face and returns an index to the terminating vertex of the inner half-edge (the target). The best way to declare the circulator is to use the method pcl::geometry::MeshBase::getVertexAroundFaceCirculator ().
491  * \tparam MeshT Mesh to which this circulator belongs to.
492  * \note The circulator can't be used to change the connectivity in the mesh (only const circulators are valid).
493  * \author Martin Saelzle
494  * \ingroup geometry
495  */
496  template <class MeshT>
498  : boost::equality_comparable <pcl::geometry::VertexAroundFaceCirculator <MeshT>
499  , boost::unit_steppable <pcl::geometry::VertexAroundFaceCirculator <MeshT>
500  > >
501  {
502  public:
503 
504  typedef boost::equality_comparable <pcl::geometry::VertexAroundFaceCirculator <MeshT>
505  , boost::unit_steppable <pcl::geometry::VertexAroundFaceCirculator <MeshT> > > Base;
507 
508  typedef MeshT Mesh;
509  typedef typename Mesh::VertexIndex VertexIndex;
510  typedef typename Mesh::FaceIndex FaceIndex;
511  typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
512 
513  /** \brief Constructor resulting in an invalid circulator. */
515  : mesh_ (NULL),
517  {
518  }
519 
520  /** \brief Construct from the face around which we want to circulate. */
522  Mesh*const mesh)
523  : mesh_ (mesh),
524  idx_inner_half_edge_ (mesh->getInnerHalfEdgeIndex (idx_face))
525  {
526  }
527 
528  /** \brief Construct directly from the inner half-edge. */
529  VertexAroundFaceCirculator (const HalfEdgeIndex& idx_inner_half_edge,
530  Mesh*const mesh)
531  : mesh_ (mesh),
532  idx_inner_half_edge_ (idx_inner_half_edge)
533  {
534  }
535 
536  /** \brief Check if the circulator is valid.
537  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure this yourself when constructing the circulator. */
538  inline bool
539  isValid () const
540  {
541  return (idx_inner_half_edge_.isValid ());
542  }
543 
544  /** \brief Comparison operators (with boost::operators): == !=
545  * \warning Does NOT check if the circulators belong to the same mesh. Please check this yourself. */
546  inline bool
547  operator == (const Self& other) const
548  {
549  return (idx_inner_half_edge_ == other.idx_inner_half_edge_);
550  }
551 
552  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
553  inline Self&
555  {
556  idx_inner_half_edge_ = mesh_->getNextHalfEdgeIndex (idx_inner_half_edge_);
557  return (*this);
558  }
559 
560  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
561  inline Self&
563  {
564  idx_inner_half_edge_ = mesh_->getPrevHalfEdgeIndex (idx_inner_half_edge_);
565  return (*this);
566  }
567 
568  /** \brief Get the index to the target vertex. */
569  inline VertexIndex
570  getTargetIndex () const
571  {
572  return (mesh_->getTerminatingVertexIndex (idx_inner_half_edge_));
573  }
574 
575  /** \brief Get the half-edge that is currently stored in the circulator. */
576  inline HalfEdgeIndex
578  {
579  return (idx_inner_half_edge_);
580  }
581 
582  /** \brief The mesh to which this circulator belongs to. */
584 
585  /** \brief The inner half-edge of the face around which we want to circulate. */
587  };
588  } // End namespace geometry
589 } // End namespace pcl
590 
591 ////////////////////////////////////////////////////////////////////////////////
592 // InnerHalfEdgeAroundFaceCirculator
593 ////////////////////////////////////////////////////////////////////////////////
594 
595 namespace pcl
596 {
597  namespace geometry
598  {
599  /** \brief Circulates clockwise around a face and returns an index to the inner half-edge (the target). The best way to declare the circulator is to use the method pcl::geometry::MeshBase::getInnerHalfEdgeAroundFaceCirculator ().
600  * \tparam MeshT Mesh to which this circulator belongs to.
601  * \note The circulator can't be used to change the connectivity in the mesh (only const circulators are valid).
602  * \author Martin Saelzle
603  * \ingroup geometry
604  */
605  template <class MeshT>
607  : boost::equality_comparable <pcl::geometry::InnerHalfEdgeAroundFaceCirculator <MeshT>
608  , boost::unit_steppable <pcl::geometry::InnerHalfEdgeAroundFaceCirculator <MeshT>
609  > >
610  {
611  public:
612 
613  typedef boost::equality_comparable <pcl::geometry::InnerHalfEdgeAroundFaceCirculator <MeshT>
614  , boost::unit_steppable <pcl::geometry::InnerHalfEdgeAroundFaceCirculator <MeshT> > > Base;
616 
617  typedef MeshT Mesh;
618  typedef typename Mesh::FaceIndex FaceIndex;
619  typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
620 
621  /** \brief Constructor resulting in an invalid circulator. */
623  : mesh_ (NULL),
625  {
626  }
627 
628  /** \brief Construct from the face around which we want to circulate. */
630  Mesh*const mesh)
631  : mesh_ (mesh),
632  idx_inner_half_edge_ (mesh->getInnerHalfEdgeIndex (idx_face))
633  {
634  }
635 
636  /** \brief Construct directly from the inner half-edge. */
638  Mesh*const mesh)
639  : mesh_ (mesh),
640  idx_inner_half_edge_ (idx_inner_half_edge)
641  {
642  }
643 
644  /** \brief Check if the circulator is valid.
645  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure this yourself when constructing the circulator. */
646  inline bool
647  isValid () const
648  {
649  return (idx_inner_half_edge_.isValid ());
650  }
651 
652  /** \brief Comparison operators (with boost::operators): == !=
653  * \warning Does NOT check if the circulators belong to the same mesh. Please check this yourself. */
654  inline bool
655  operator == (const Self& other) const
656  {
657  return (idx_inner_half_edge_ == other.idx_inner_half_edge_);
658  }
659 
660  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
661  inline Self&
663  {
664  idx_inner_half_edge_ = mesh_->getNextHalfEdgeIndex (idx_inner_half_edge_);
665  return (*this);
666  }
667 
668  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
669  inline Self&
671  {
672  idx_inner_half_edge_ = mesh_->getPrevHalfEdgeIndex (idx_inner_half_edge_);
673  return (*this);
674  }
675 
676  /** \brief Get the index to the inner half-edge. */
677  inline HalfEdgeIndex
678  getTargetIndex () const
679  {
680  return (idx_inner_half_edge_);
681  }
682 
683  /** \brief Get the half-edge that is currently stored in the circulator. */
684  inline HalfEdgeIndex
686  {
687  return (idx_inner_half_edge_);
688  }
689 
690  /** \brief The mesh to which this circulator belongs to. */
692 
693  /** \brief The inner half-edge of the face around which we want to circulate. */
695  };
696  } // End namespace geometry
697 } // End namespace pcl
698 
699 ////////////////////////////////////////////////////////////////////////////////
700 // OuterHalfEdgeAroundFaceCirculator
701 ////////////////////////////////////////////////////////////////////////////////
702 
703 namespace pcl
704 {
705  namespace geometry
706  {
707  /** \brief Circulates clockwise around a face and returns an index to the outer half-edge (the target). The best way to declare the circulator is to use the method pcl::geometry::MeshBase::getOuterHalfEdgeAroundFaceCirculator ().
708  * \tparam MeshT Mesh to which this circulator belongs to.
709  * \note The circulator can't be used to change the connectivity in the mesh (only const circulators are valid).
710  * \author Martin Saelzle
711  * \ingroup geometry
712  */
713  template <class MeshT>
715  : boost::equality_comparable <pcl::geometry::OuterHalfEdgeAroundFaceCirculator <MeshT>
716  , boost::unit_steppable <pcl::geometry::OuterHalfEdgeAroundFaceCirculator <MeshT>
717  > >
718  {
719  public:
720 
721  typedef boost::equality_comparable <pcl::geometry::OuterHalfEdgeAroundFaceCirculator <MeshT>
722  , boost::unit_steppable <pcl::geometry::OuterHalfEdgeAroundFaceCirculator <MeshT> > > Base;
724 
725  typedef MeshT Mesh;
726  typedef typename Mesh::FaceIndex FaceIndex;
727  typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
728 
729  /** \brief Constructor resulting in an invalid circulator. */
731  : mesh_ (NULL),
733  {
734  }
735 
736  /** \brief Construct from the face around which we want to circulate. */
738  Mesh*const mesh)
739  : mesh_ (mesh),
740  idx_inner_half_edge_ (mesh->getInnerHalfEdgeIndex (idx_face))
741  {
742  }
743 
744  /** \brief Construct directly from the inner half-edge. */
746  Mesh*const mesh)
747  : mesh_ (mesh),
748  idx_inner_half_edge_ (idx_inner_half_edge)
749  {
750  }
751 
752  /** \brief Check if the circulator is valid.
753  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure this yourself when constructing the circulator. */
754  inline bool
755  isValid () const
756  {
757  return (idx_inner_half_edge_.isValid ());
758  }
759 
760  /** \brief Comparison operators (with boost::operators): == !=
761  * \warning Does NOT check if the circulators belong to the same mesh. Please check this yourself. */
762  inline bool
763  operator == (const Self& other) const
764  {
765  return (idx_inner_half_edge_ == other.idx_inner_half_edge_);
766  }
767 
768  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
769  inline Self&
771  {
772  idx_inner_half_edge_ = mesh_->getNextHalfEdgeIndex (idx_inner_half_edge_);
773  return (*this);
774  }
775 
776  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
777  inline Self&
779  {
780  idx_inner_half_edge_ = mesh_->getPrevHalfEdgeIndex (idx_inner_half_edge_);
781  return (*this);
782  }
783 
784  /** \brief Get the index to the outer half-edge. */
785  inline HalfEdgeIndex
786  getTargetIndex () const
787  {
788  return (mesh_->getOppositeHalfEdgeIndex (idx_inner_half_edge_));
789  }
790 
791  /** \brief Get the half-edge that is currently stored in the circulator. */
792  inline HalfEdgeIndex
794  {
795  return (idx_inner_half_edge_);
796  }
797 
798  /** \brief The mesh to which this circulator belongs to. */
800 
801  /** \brief The inner half-edge of the face around which we want to circulate. */
803  };
804  } // End namespace geometry
805 } // End namespace pcl
806 
807 ////////////////////////////////////////////////////////////////////////////////
808 // FaceAroundFaceCirculator
809 ////////////////////////////////////////////////////////////////////////////////
810 
811 namespace pcl
812 {
813  namespace geometry
814  {
815  /** \brief Circulates clockwise around a face and returns an index to the face of the outer half-edge (the target). The best way to declare the circulator is to use the method pcl::geometry::MeshBase::getFaceAroundFaceCirculator ().
816  * \tparam MeshT Mesh to which this circulator belongs to.
817  * \note The circulator can't be used to change the connectivity in the mesh (only const circulators are valid).
818  * \author Martin Saelzle
819  * \ingroup geometry
820  */
821  template <class MeshT>
823  : boost::equality_comparable <pcl::geometry::FaceAroundFaceCirculator <MeshT>
824  , boost::unit_steppable <pcl::geometry::FaceAroundFaceCirculator <MeshT>
825  > >
826  {
827  public:
828 
829  typedef boost::equality_comparable <pcl::geometry::FaceAroundFaceCirculator <MeshT>
830  , boost::unit_steppable <pcl::geometry::FaceAroundFaceCirculator <MeshT> > > Base;
832 
833  typedef MeshT Mesh;
834  typedef typename Mesh::FaceIndex FaceIndex;
835  typedef typename Mesh::HalfEdgeIndex HalfEdgeIndex;
836 
837  /** \brief Constructor resulting in an invalid circulator. */
839  : mesh_ (NULL),
841  {
842  }
843 
844  /** \brief Construct from the face around which we want to circulate. */
846  Mesh*const mesh)
847  : mesh_ (mesh),
848  idx_inner_half_edge_ (mesh->getInnerHalfEdgeIndex (idx_face))
849  {
850  }
851 
852  /** \brief Construct directly from the inner half-edge. */
853  FaceAroundFaceCirculator (const HalfEdgeIndex& idx_inner_half_edge,
854  Mesh*const mesh)
855  : mesh_ (mesh),
856  idx_inner_half_edge_ (idx_inner_half_edge)
857  {
858  }
859 
860  /** \brief Check if the circulator is valid.
861  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure this yourself when constructing the circulator. */
862  inline bool
863  isValid () const
864  {
865  return (idx_inner_half_edge_.isValid ());
866  }
867 
868  /** \brief Comparison operators (with boost::operators): == !=
869  * \warning Does NOT check if the circulators belong to the same mesh. Please check this yourself. */
870  inline bool
871  operator == (const Self& other) const
872  {
873  return (idx_inner_half_edge_ == other.idx_inner_half_edge_);
874  }
875 
876  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
877  inline Self&
879  {
880  idx_inner_half_edge_ = mesh_->getNextHalfEdgeIndex (idx_inner_half_edge_);
881  return (*this);
882  }
883 
884  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
885  inline Self&
887  {
888  idx_inner_half_edge_ = mesh_->getPrevHalfEdgeIndex (idx_inner_half_edge_);
889  return (*this);
890  }
891 
892  /** \brief Get the index to the target face. */
893  inline FaceIndex
894  getTargetIndex () const
895  {
896  return (mesh_->getOppositeFaceIndex (idx_inner_half_edge_));
897  }
898 
899  /** \brief Get the half-edge that is currently stored in the circulator. */
900  inline HalfEdgeIndex
902  {
903  return (idx_inner_half_edge_);
904  }
905 
906  /** \brief The mesh to which this circulator belongs to. */
908 
909  /** \brief The inner half-edge of the face around which we want to circulate. */
911  };
912  } // End namespace geometry
913 } // End namespace pcl
914 
915 #endif // PCL_GEOMETRY_MESH_CIRCULATORS_H
HalfEdgeIndex getTargetIndex() const
Get the index to the inner half-edge.
HalfEdgeIndex idx_inner_half_edge_
The inner half-edge of the face around which we want to circulate.
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
pcl::geometry::FaceAroundVertexCirculator< MeshT > Self
VertexAroundVertexCirculator(const VertexIndex &idx_vertex, Mesh *const mesh)
Construct from the vertex around which we want to circulate.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
FaceIndex getTargetIndex() const
Get the index to the target face.
boost::equality_comparable< pcl::geometry::VertexAroundVertexCirculator< MeshT >, boost::unit_steppable< pcl::geometry::VertexAroundVertexCirculator< MeshT > > > Base
FaceAroundVertexCirculator(const VertexIndex &idx_vertex, Mesh *const mesh)
Construct from the vertex around which we want to circulate.
VertexAroundFaceCirculator(const HalfEdgeIndex &idx_inner_half_edge, Mesh *const mesh)
Construct directly from the inner half-edge.
Index used to access elements in the half-edge mesh.
Definition: mesh_indices.h:479
OutgoingHalfEdgeAroundVertexCirculator(const VertexIndex &idx_vertex, Mesh *const mesh)
Construct from the vertex around which we want to circulate.
bool isValid() const
Check if the circulator is valid.
InnerHalfEdgeAroundFaceCirculator(const FaceIndex &idx_face, Mesh *const mesh)
Construct from the face around which we want to circulate.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
Mesh * mesh_
The mesh to which this circulator belongs to.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
boost::equality_comparable< pcl::geometry::InnerHalfEdgeAroundFaceCirculator< MeshT >, boost::unit_steppable< pcl::geometry::InnerHalfEdgeAroundFaceCirculator< MeshT > > > Base
FaceAroundFaceCirculator(const FaceIndex &idx_face, Mesh *const mesh)
Construct from the face around which we want to circulate.
pcl::geometry::InnerHalfEdgeAroundFaceCirculator< MeshT > Self
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
Mesh * mesh_
The mesh to which this circulator belongs to.
pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator< MeshT > Self
Circulates counter-clockwise around a vertex and returns an index to the terminating vertex of the ou...
pcl::geometry::VertexAroundFaceCirculator< MeshT > Self
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
bool isValid() const
Check if the circulator is valid.
Circulates clockwise around a face and returns an index to the inner half-edge (the target)...
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
OutgoingHalfEdgeAroundVertexCirculator(const HalfEdgeIndex &idx_outgoing_half_edge, Mesh *const mesh)
Construct directly from the outgoing half-edge.
VertexIndex getTargetIndex() const
Get the index to the target vertex.
Circulates counter-clockwise around a vertex and returns an index to the face of the outgoing half-ed...
pcl::geometry::OuterHalfEdgeAroundFaceCirculator< MeshT > Self
bool isValid() const
Check if the circulator is valid.
bool isValid() const
Check if the circulator is valid.
VertexAroundFaceCirculator()
Constructor resulting in an invalid circulator.
InnerHalfEdgeAroundFaceCirculator(const HalfEdgeIndex &idx_inner_half_edge, Mesh *const mesh)
Construct directly from the inner half-edge.
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
VertexAroundFaceCirculator(const FaceIndex &idx_face, Mesh *const mesh)
Construct from the face around which we want to circulate.
FaceAroundVertexCirculator(const HalfEdgeIndex &idx_outgoing_half_edge, Mesh *const mesh)
Construct directly from the outgoing half-edge.
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
OuterHalfEdgeAroundFaceCirculator()
Constructor resulting in an invalid circulator.
Circulates counter-clockwise around a vertex and returns an index to the incoming half-edge (the targ...
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
HalfEdgeIndex getTargetIndex() const
Get the index to the incoming half-edge.
OutgoingHalfEdgeAroundVertexCirculator()
Constructor resulting in an invalid circulator.
VertexAroundVertexCirculator()
Constructor resulting in an invalid circulator.
Index used to access elements in the half-edge mesh.
Definition: mesh_indices.h:201
Circulates counter-clockwise around a vertex and returns an index to the outgoing half-edge (the targ...
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
HalfEdgeIndex idx_inner_half_edge_
The inner half-edge of the face around which we want to circulate.
bool isValid() const
Check if the circulator is valid.
IncomingHalfEdgeAroundVertexCirculator(const HalfEdgeIndex &idx_incoming_half_edge, Mesh *const mesh)
Construct directly from the incoming half-edge.
Mesh * mesh_
The mesh to which this circulator belongs to.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
HalfEdgeIndex idx_outgoing_half_edge_
The outgoing half-edge of the vertex around which we want to circulate.
FaceAroundFaceCirculator()
Constructor resulting in an invalid circulator.
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
VertexIndex getTargetIndex() const
Get the index to the target vertex.
OuterHalfEdgeAroundFaceCirculator(const FaceIndex &idx_face, Mesh *const mesh)
Construct from the face around which we want to circulate.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
pcl::geometry::IncomingHalfEdgeAroundVertexCirculator< MeshT > Self
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
Mesh * mesh_
The mesh to which this circulator belongs to.
Circulates clockwise around a face and returns an index to the terminating vertex of the inner half-e...
FaceAroundFaceCirculator(const HalfEdgeIndex &idx_inner_half_edge, Mesh *const mesh)
Construct directly from the inner half-edge.
boost::equality_comparable< pcl::geometry::IncomingHalfEdgeAroundVertexCirculator< MeshT >, boost::unit_steppable< pcl::geometry::IncomingHalfEdgeAroundVertexCirculator< MeshT > > > Base
InnerHalfEdgeAroundFaceCirculator()
Constructor resulting in an invalid circulator.
HalfEdgeIndex idx_outgoing_half_edge_
The outgoing half-edge of the vertex around which we want to circulate.
HalfEdgeIndex idx_outgoing_half_edge_
The outgoing half-edge of the vertex around which we want to circulate.
HalfEdgeIndex idx_incoming_half_edge_
The incoming half-edge of the vertex around which we want to circulate.
Circulates clockwise around a face and returns an index to the face of the outer half-edge (the targe...
bool isValid() const
Check if the circulator is valid.
Index used to access elements in the half-edge mesh.
Definition: mesh_indices.h:62
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
bool isValid() const
Check if the circulator is valid.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
IncomingHalfEdgeAroundVertexCirculator(const VertexIndex &idx_vertex, Mesh *const mesh)
Construct from the vertex around which we want to circulate.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
boost::equality_comparable< pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator< MeshT >, boost::unit_steppable< pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator< MeshT > > > Base
HalfEdgeIndex idx_inner_half_edge_
The inner half-edge of the face around which we want to circulate.
HalfEdgeIndex idx_inner_half_edge_
The inner half-edge of the face around which we want to circulate.
FaceIndex getTargetIndex() const
Get the index to the target face.
HalfEdgeIndex getTargetIndex() const
Get the index to the outgoing half-edge.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
bool isValid() const
Check if the circulator is valid.
boost::equality_comparable< pcl::geometry::FaceAroundVertexCirculator< MeshT >, boost::unit_steppable< pcl::geometry::FaceAroundVertexCirculator< MeshT > > > Base
Circulates clockwise around a face and returns an index to the outer half-edge (the target)...
boost::equality_comparable< pcl::geometry::FaceAroundFaceCirculator< MeshT >, boost::unit_steppable< pcl::geometry::FaceAroundFaceCirculator< MeshT > > > Base
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
IncomingHalfEdgeAroundVertexCirculator()
Constructor resulting in an invalid circulator.
FaceAroundVertexCirculator()
Constructor resulting in an invalid circulator.
pcl::geometry::FaceAroundFaceCirculator< MeshT > Self
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
OuterHalfEdgeAroundFaceCirculator(const HalfEdgeIndex &idx_inner_half_edge, Mesh *const mesh)
Construct directly from the inner half-edge.
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
VertexAroundVertexCirculator(const HalfEdgeIndex &idx_outgoing_half_edge, Mesh *const mesh)
Construct directly from the outgoing half-edge.
HalfEdgeIndex getTargetIndex() const
Get the index to the outer half-edge.
pcl::geometry::VertexAroundVertexCirculator< MeshT > Self
Mesh * mesh_
The mesh to which this circulator belongs to.
Mesh * mesh_
The mesh to which this circulator belongs to.
Mesh * mesh_
The mesh to which this circulator belongs to.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
Definition: surface.h:14
boost::equality_comparable< pcl::geometry::OuterHalfEdgeAroundFaceCirculator< MeshT >, boost::unit_steppable< pcl::geometry::OuterHalfEdgeAroundFaceCirculator< MeshT > > > Base
boost::equality_comparable< pcl::geometry::VertexAroundFaceCirculator< MeshT >, boost::unit_steppable< pcl::geometry::VertexAroundFaceCirculator< MeshT > > > Base
Mesh * mesh_
The mesh to which this circulator belongs to.