Point Cloud Library (PCL)  1.14.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
42 // 'pcl_src/geometry/include/pcl/geometry/mesh_circulators.py'
43 
44 #pragma once
45 
46 #include <pcl/geometry/mesh_indices.h>
47 
48 #include <boost/operators.hpp>
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 // VertexAroundVertexCirculator
52 ////////////////////////////////////////////////////////////////////////////////
53 
54 namespace pcl {
55 namespace geometry {
56 /** \brief Circulates counter-clockwise around a vertex and returns an index to the
57  * terminating vertex of the outgoing half-edge (the target). The best way to declare
58  * the circulator is to use the method
59  * pcl::geometry::MeshBase::getVertexAroundVertexCirculator ().
60  * \tparam MeshT Mesh to which this circulator belongs to.
61  * \note The circulator can't be used to change the connectivity in the mesh (only
62  * const circulators are valid).
63  * \author Martin Saelzle
64  * \ingroup geometry
65  */
66 template <class MeshT>
68 : boost::equality_comparable<
69  pcl::geometry::VertexAroundVertexCirculator<MeshT>,
70  boost::unit_steppable<pcl::geometry::VertexAroundVertexCirculator<MeshT>>> {
71 public:
72  using Base = boost::equality_comparable<
74  boost::unit_steppable<pcl::geometry::VertexAroundVertexCirculator<MeshT>>>;
75  using Self = pcl::geometry::VertexAroundVertexCirculator<MeshT>;
76 
77  using Mesh = MeshT;
78  using VertexIndex = typename Mesh::VertexIndex;
80 
81  /** \brief Constructor resulting in an invalid circulator. */
83 
84  /** \brief Construct from the vertex around which we want to circulate. */
85  VertexAroundVertexCirculator(const VertexIndex& idx_vertex, Mesh* const mesh)
86  : mesh_(mesh), idx_outgoing_half_edge_(mesh->getOutgoingHalfEdgeIndex(idx_vertex))
87  {}
88 
89  /** \brief Construct directly from the outgoing half-edge. */
90  VertexAroundVertexCirculator(const HalfEdgeIndex& idx_outgoing_half_edge,
91  Mesh* const mesh)
92  : mesh_(mesh), idx_outgoing_half_edge_(idx_outgoing_half_edge)
93  {}
94 
95  /** \brief Check if the circulator is valid.
96  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure
97  * this yourself when constructing the circulator. */
98  inline bool
99  isValid() const
100  {
101  return (idx_outgoing_half_edge_.isValid());
102  }
103 
104  /** \brief Comparison operators (with boost::operators): == !=
105  * \warning Does NOT check if the circulators belong to the same mesh. Please check
106  * this yourself. */
107  inline bool
108  operator==(const Self& other) const
109  {
111  }
112 
113  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
114  inline Self&
116  {
117  idx_outgoing_half_edge_ = mesh_->getNextHalfEdgeIndex(
118  mesh_->getOppositeHalfEdgeIndex(idx_outgoing_half_edge_));
119  return (*this);
120  }
121 
122  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
123  inline Self&
125  {
126  idx_outgoing_half_edge_ = mesh_->getOppositeHalfEdgeIndex(
127  mesh_->getPrevHalfEdgeIndex(idx_outgoing_half_edge_));
128  return (*this);
129  }
130 
131  /** \brief Get the index to the target vertex. */
132  inline VertexIndex
134  {
135  return (mesh_->getTerminatingVertexIndex(idx_outgoing_half_edge_));
136  }
137 
138  /** \brief Get the half-edge that is currently stored in the circulator. */
139  inline HalfEdgeIndex
141  {
142  return (idx_outgoing_half_edge_);
143  }
144 
145  /** \brief The mesh to which this circulator belongs to. */
147 
148  /** \brief The outgoing half-edge of the vertex around which we want to circulate. */
150 };
151 } // End namespace geometry
152 } // End namespace pcl
153 
154 ////////////////////////////////////////////////////////////////////////////////
155 // OutgoingHalfEdgeAroundVertexCirculator
156 ////////////////////////////////////////////////////////////////////////////////
157 
158 namespace pcl {
159 namespace geometry {
160 /** \brief Circulates counter-clockwise around a vertex and returns an index to the
161  * outgoing half-edge (the target). The best way to declare the circulator is to use the
162  * method pcl::geometry::MeshBase::getOutgoingHalfEdgeAroundVertexCirculator ().
163  * \tparam MeshT Mesh to which this circulator belongs to.
164  * \note The circulator can't be used to
165  * change the connectivity in the mesh (only const circulators are valid).
166  * \author Martin Saelzle
167  * \ingroup geometry
168  */
169 template <class MeshT>
171 : boost::equality_comparable<
172  pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator<MeshT>,
173  boost::unit_steppable<
174  pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator<MeshT>>> {
175 public:
176  using Base = boost::equality_comparable<
178  boost::unit_steppable<
179  pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator<MeshT>>>;
180  using Self = pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator<MeshT>;
181 
182  using Mesh = MeshT;
183  using VertexIndex = typename Mesh::VertexIndex;
185 
186  /** \brief Constructor resulting in an invalid circulator. */
188  {}
189 
190  /** \brief Construct from the vertex around which we want to circulate. */
192  Mesh* const mesh)
193  : mesh_(mesh), idx_outgoing_half_edge_(mesh->getOutgoingHalfEdgeIndex(idx_vertex))
194  {}
195 
196  /** \brief Construct directly from the outgoing half-edge. */
198  Mesh* const mesh)
199  : mesh_(mesh), idx_outgoing_half_edge_(idx_outgoing_half_edge)
200  {}
201 
202  /** \brief Check if the circulator is valid.
203  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure
204  * this yourself when constructing the circulator. */
205  inline bool
206  isValid() const
207  {
208  return (idx_outgoing_half_edge_.isValid());
209  }
210 
211  /** \brief Comparison operators (with boost::operators): == !=
212  * \warning Does NOT check if the circulators belong to the same mesh. Please check
213  * this yourself. */
214  inline bool
215  operator==(const Self& other) const
216  {
218  }
219 
220  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
221  inline Self&
223  {
224  idx_outgoing_half_edge_ = mesh_->getNextHalfEdgeIndex(
225  mesh_->getOppositeHalfEdgeIndex(idx_outgoing_half_edge_));
226  return (*this);
227  }
228 
229  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
230  inline Self&
232  {
233  idx_outgoing_half_edge_ = mesh_->getOppositeHalfEdgeIndex(
234  mesh_->getPrevHalfEdgeIndex(idx_outgoing_half_edge_));
235  return (*this);
236  }
237 
238  /** \brief Get the index to the outgoing half-edge. */
239  inline HalfEdgeIndex
241  {
242  return (idx_outgoing_half_edge_);
243  }
244 
245  /** \brief Get the half-edge that is currently stored in the circulator. */
246  inline HalfEdgeIndex
248  {
249  return (idx_outgoing_half_edge_);
250  }
251 
252  /** \brief The mesh to which this circulator belongs to. */
254 
255  /** \brief The outgoing half-edge of the vertex around which we want to circulate. */
257 };
258 } // End namespace geometry
259 } // End namespace pcl
260 
261 ////////////////////////////////////////////////////////////////////////////////
262 // IncomingHalfEdgeAroundVertexCirculator
263 ////////////////////////////////////////////////////////////////////////////////
264 
265 namespace pcl {
266 namespace geometry {
267 /** \brief Circulates counter-clockwise around a vertex and returns an index to the
268  * incoming half-edge (the target). The best way to declare the circulator is to use the
269  * method pcl::geometry::MeshBase::getIncomingHalfEdgeAroundVertexCirculator ().
270  * \tparam MeshT Mesh to which this circulator belongs to.
271  * \note The circulator can't be used to change the connectivity in the mesh (only
272  * const circulators are valid).
273  * \author Martin Saelzle
274  * \ingroup geometry
275  */
276 template <class MeshT>
278 : boost::equality_comparable<
279  pcl::geometry::IncomingHalfEdgeAroundVertexCirculator<MeshT>,
280  boost::unit_steppable<
281  pcl::geometry::IncomingHalfEdgeAroundVertexCirculator<MeshT>>> {
282 public:
283  using Base = boost::equality_comparable<
285  boost::unit_steppable<
286  pcl::geometry::IncomingHalfEdgeAroundVertexCirculator<MeshT>>>;
287  using Self = pcl::geometry::IncomingHalfEdgeAroundVertexCirculator<MeshT>;
288 
289  using Mesh = MeshT;
290  using VertexIndex = typename Mesh::VertexIndex;
292 
293  /** \brief Constructor resulting in an invalid circulator. */
295  {}
296 
297  /** \brief Construct from the vertex around which we want to circulate. */
299  Mesh* const mesh)
300  : mesh_(mesh), idx_incoming_half_edge_(mesh->getIncomingHalfEdgeIndex(idx_vertex))
301  {}
302 
303  /** \brief Construct directly from the incoming half-edge. */
305  Mesh* const mesh)
306  : mesh_(mesh), idx_incoming_half_edge_(idx_incoming_half_edge)
307  {}
308 
309  /** \brief Check if the circulator is valid.
310  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure
311  * this yourself when constructing the circulator. */
312  inline bool
313  isValid() const
314  {
315  return (idx_incoming_half_edge_.isValid());
316  }
317 
318  /** \brief Comparison operators (with boost::operators): == !=
319  * \warning Does NOT check if the circulators belong to the same mesh. Please check
320  * this yourself. */
321  inline bool
322  operator==(const Self& other) const
323  {
325  }
326 
327  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
328  inline Self&
330  {
331  idx_incoming_half_edge_ = mesh_->getOppositeHalfEdgeIndex(
332  mesh_->getNextHalfEdgeIndex(idx_incoming_half_edge_));
333  return (*this);
334  }
335 
336  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
337  inline Self&
339  {
340  idx_incoming_half_edge_ = mesh_->getPrevHalfEdgeIndex(
341  mesh_->getOppositeHalfEdgeIndex(idx_incoming_half_edge_));
342  return (*this);
343  }
344 
345  /** \brief Get the index to the incoming half-edge. */
346  inline HalfEdgeIndex
348  {
349  return (idx_incoming_half_edge_);
350  }
351 
352  /** \brief Get the half-edge that is currently stored in the circulator. */
353  inline HalfEdgeIndex
355  {
356  return (idx_incoming_half_edge_);
357  }
358 
359  /** \brief The mesh to which this circulator belongs to. */
361 
362  /** \brief The incoming half-edge of the vertex around which we want to circulate. */
364 };
365 } // End namespace geometry
366 } // End namespace pcl
367 
368 ////////////////////////////////////////////////////////////////////////////////
369 // FaceAroundVertexCirculator
370 ////////////////////////////////////////////////////////////////////////////////
371 
372 namespace pcl {
373 namespace geometry {
374 /** \brief Circulates counter-clockwise around a vertex and returns an index to the face
375  * of the outgoing half-edge (the target). The best way to declare the circulator is to
376  * use the method pcl::geometry::MeshBase::getFaceAroundVertexCirculator ().
377  * \tparam MeshT Mesh to which this circulator belongs to.
378  * \note The circulator can't be used to change the connectivity in the mesh (only
379  * const circulators are valid).
380  * \author Martin Saelzle
381  * \ingroup geometry
382  */
383 template <class MeshT>
385 : boost::equality_comparable<
386  pcl::geometry::FaceAroundVertexCirculator<MeshT>,
387  boost::unit_steppable<pcl::geometry::FaceAroundVertexCirculator<MeshT>>> {
388 public:
389  using Base = boost::equality_comparable<
391  boost::unit_steppable<pcl::geometry::FaceAroundVertexCirculator<MeshT>>>;
392  using Self = pcl::geometry::FaceAroundVertexCirculator<MeshT>;
393 
394  using Mesh = MeshT;
395  using FaceIndex = typename Mesh::FaceIndex;
396  using VertexIndex = typename Mesh::VertexIndex;
398 
399  /** \brief Constructor resulting in an invalid circulator. */
401 
402  /** \brief Construct from the vertex around which we want to circulate. */
403  FaceAroundVertexCirculator(const VertexIndex& idx_vertex, Mesh* const mesh)
404  : mesh_(mesh), idx_outgoing_half_edge_(mesh->getOutgoingHalfEdgeIndex(idx_vertex))
405  {}
406 
407  /** \brief Construct directly from the outgoing half-edge. */
408  FaceAroundVertexCirculator(const HalfEdgeIndex& idx_outgoing_half_edge,
409  Mesh* const mesh)
410  : mesh_(mesh), idx_outgoing_half_edge_(idx_outgoing_half_edge)
411  {}
412 
413  /** \brief Check if the circulator is valid.
414  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure
415  * this yourself when constructing the circulator. */
416  inline bool
417  isValid() const
418  {
419  return (idx_outgoing_half_edge_.isValid());
420  }
421 
422  /** \brief Comparison operators (with boost::operators): == !=
423  * \warning Does NOT check if the circulators belong to the same mesh. Please check
424  * this yourself. */
425  inline bool
426  operator==(const Self& other) const
427  {
429  }
430 
431  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
432  inline Self&
434  {
435  idx_outgoing_half_edge_ = mesh_->getNextHalfEdgeIndex(
436  mesh_->getOppositeHalfEdgeIndex(idx_outgoing_half_edge_));
437  return (*this);
438  }
439 
440  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
441  inline Self&
443  {
444  idx_outgoing_half_edge_ = mesh_->getOppositeHalfEdgeIndex(
445  mesh_->getPrevHalfEdgeIndex(idx_outgoing_half_edge_));
446  return (*this);
447  }
448 
449  /** \brief Get the index to the target face. */
450  inline FaceIndex
452  {
453  return (mesh_->getFaceIndex(idx_outgoing_half_edge_));
454  }
455 
456  /** \brief Get the half-edge that is currently stored in the circulator. */
457  inline HalfEdgeIndex
459  {
460  return (idx_outgoing_half_edge_);
461  }
462 
463  /** \brief The mesh to which this circulator belongs to. */
465 
466  /** \brief The outgoing half-edge of the vertex around which we want to circulate. */
468 };
469 } // End namespace geometry
470 } // End namespace pcl
471 
472 ////////////////////////////////////////////////////////////////////////////////
473 // VertexAroundFaceCirculator
474 ////////////////////////////////////////////////////////////////////////////////
475 
476 namespace pcl {
477 namespace geometry {
478 /** \brief Circulates clockwise around a face and returns an index to the terminating
479  * vertex of the inner half-edge (the target). The best way to declare the circulator is
480  * to use the method pcl::geometry::MeshBase::getVertexAroundFaceCirculator ().
481  * \tparam MeshT Mesh to which this circulator belongs to.
482  * \note The circulator can't be used to change the connectivity in the mesh (only
483  * const circulators are valid).
484  * \author Martin Saelzle
485  * \ingroup geometry
486  */
487 template <class MeshT>
489 : boost::equality_comparable<
490  pcl::geometry::VertexAroundFaceCirculator<MeshT>,
491  boost::unit_steppable<pcl::geometry::VertexAroundFaceCirculator<MeshT>>> {
492 public:
493  using Base = boost::equality_comparable<
495  boost::unit_steppable<pcl::geometry::VertexAroundFaceCirculator<MeshT>>>;
496  using Self = pcl::geometry::VertexAroundFaceCirculator<MeshT>;
497 
498  using Mesh = MeshT;
499  using VertexIndex = typename Mesh::VertexIndex;
500  using FaceIndex = typename Mesh::FaceIndex;
502 
503  /** \brief Constructor resulting in an invalid circulator. */
505 
506  /** \brief Construct from the face around which we want to circulate. */
507  VertexAroundFaceCirculator(const FaceIndex& idx_face, Mesh* const mesh)
508  : mesh_(mesh), idx_inner_half_edge_(mesh->getInnerHalfEdgeIndex(idx_face))
509  {}
510 
511  /** \brief Construct directly from the inner half-edge. */
512  VertexAroundFaceCirculator(const HalfEdgeIndex& idx_inner_half_edge, Mesh* const mesh)
513  : mesh_(mesh), idx_inner_half_edge_(idx_inner_half_edge)
514  {}
515 
516  /** \brief Check if the circulator is valid.
517  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure
518  * this yourself when constructing the circulator. */
519  inline bool
520  isValid() const
521  {
522  return (idx_inner_half_edge_.isValid());
523  }
524 
525  /** \brief Comparison operators (with boost::operators): == !=
526  * \warning Does NOT check if the circulators belong to the same mesh. Please check
527  * this yourself. */
528  inline bool
529  operator==(const Self& other) const
530  {
531  return (idx_inner_half_edge_ == other.idx_inner_half_edge_);
532  }
533 
534  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
535  inline Self&
537  {
538  idx_inner_half_edge_ = mesh_->getNextHalfEdgeIndex(idx_inner_half_edge_);
539  return (*this);
540  }
541 
542  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
543  inline Self&
545  {
546  idx_inner_half_edge_ = mesh_->getPrevHalfEdgeIndex(idx_inner_half_edge_);
547  return (*this);
548  }
549 
550  /** \brief Get the index to the target vertex. */
551  inline VertexIndex
553  {
554  return (mesh_->getTerminatingVertexIndex(idx_inner_half_edge_));
555  }
556 
557  /** \brief Get the half-edge that is currently stored in the circulator. */
558  inline HalfEdgeIndex
560  {
561  return (idx_inner_half_edge_);
562  }
563 
564  /** \brief The mesh to which this circulator belongs to. */
566 
567  /** \brief The inner half-edge of the face around which we want to circulate. */
569 };
570 } // End namespace geometry
571 } // End namespace pcl
572 
573 ////////////////////////////////////////////////////////////////////////////////
574 // InnerHalfEdgeAroundFaceCirculator
575 ////////////////////////////////////////////////////////////////////////////////
576 
577 namespace pcl {
578 namespace geometry {
579 /** \brief Circulates clockwise around a face and returns an index to the inner
580  * half-edge (the target). The best way to declare the circulator is to use the method
581  * pcl::geometry::MeshBase::getInnerHalfEdgeAroundFaceCirculator ().
582  * \tparam MeshT Mesh to which this circulator belongs to.
583  * \note The circulator can't be used to change the connectivity in the mesh (only
584  * const circulators are valid).
585  * \author Martin Saelzle
586  * \ingroup geometry
587  */
588 template <class MeshT>
590 : boost::equality_comparable<
591  pcl::geometry::InnerHalfEdgeAroundFaceCirculator<MeshT>,
592  boost::unit_steppable<pcl::geometry::InnerHalfEdgeAroundFaceCirculator<MeshT>>> {
593 public:
594  using Base = boost::equality_comparable<
596  boost::unit_steppable<pcl::geometry::InnerHalfEdgeAroundFaceCirculator<MeshT>>>;
597  using Self = pcl::geometry::InnerHalfEdgeAroundFaceCirculator<MeshT>;
598 
599  using Mesh = MeshT;
600  using FaceIndex = typename Mesh::FaceIndex;
602 
603  /** \brief Constructor resulting in an invalid circulator. */
605 
606  /** \brief Construct from the face around which we want to circulate. */
607  InnerHalfEdgeAroundFaceCirculator(const FaceIndex& idx_face, Mesh* const mesh)
608  : mesh_(mesh), idx_inner_half_edge_(mesh->getInnerHalfEdgeIndex(idx_face))
609  {}
610 
611  /** \brief Construct directly from the inner half-edge. */
613  Mesh* const mesh)
614  : mesh_(mesh), idx_inner_half_edge_(idx_inner_half_edge)
615  {}
616 
617  /** \brief Check if the circulator is valid.
618  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure
619  * this yourself when constructing the circulator. */
620  inline bool
621  isValid() const
622  {
623  return (idx_inner_half_edge_.isValid());
624  }
625 
626  /** \brief Comparison operators (with boost::operators): == !=
627  * \warning Does NOT check if the circulators belong to the same mesh. Please check
628  * this yourself. */
629  inline bool
630  operator==(const Self& other) const
631  {
632  return (idx_inner_half_edge_ == other.idx_inner_half_edge_);
633  }
634 
635  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
636  inline Self&
638  {
639  idx_inner_half_edge_ = mesh_->getNextHalfEdgeIndex(idx_inner_half_edge_);
640  return (*this);
641  }
642 
643  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
644  inline Self&
646  {
647  idx_inner_half_edge_ = mesh_->getPrevHalfEdgeIndex(idx_inner_half_edge_);
648  return (*this);
649  }
650 
651  /** \brief Get the index to the inner half-edge. */
652  inline HalfEdgeIndex
654  {
655  return (idx_inner_half_edge_);
656  }
657 
658  /** \brief Get the half-edge that is currently stored in the circulator. */
659  inline HalfEdgeIndex
661  {
662  return (idx_inner_half_edge_);
663  }
664 
665  /** \brief The mesh to which this circulator belongs to. */
667 
668  /** \brief The inner half-edge of the face around which we want to circulate. */
670 };
671 } // End namespace geometry
672 } // End namespace pcl
673 
674 ////////////////////////////////////////////////////////////////////////////////
675 // OuterHalfEdgeAroundFaceCirculator
676 ////////////////////////////////////////////////////////////////////////////////
677 
678 namespace pcl {
679 namespace geometry {
680 /** \brief Circulates clockwise around a face and returns an index to the outer
681  * half-edge (the target). The best way to declare the circulator is to use the method
682  * pcl::geometry::MeshBase::getOuterHalfEdgeAroundFaceCirculator ().
683  * \tparam MeshT Mesh to which this circulator belongs to.
684  * \note The circulator can't be used to change the connectivity in the mesh (only
685  * const circulators are valid).
686  * \author Martin Saelzle
687  * \ingroup geometry
688  */
689 template <class MeshT>
691 : boost::equality_comparable<
692  pcl::geometry::OuterHalfEdgeAroundFaceCirculator<MeshT>,
693  boost::unit_steppable<pcl::geometry::OuterHalfEdgeAroundFaceCirculator<MeshT>>> {
694 public:
695  using Base = boost::equality_comparable<
697  boost::unit_steppable<pcl::geometry::OuterHalfEdgeAroundFaceCirculator<MeshT>>>;
698  using Self = pcl::geometry::OuterHalfEdgeAroundFaceCirculator<MeshT>;
699 
700  using Mesh = MeshT;
701  using FaceIndex = typename Mesh::FaceIndex;
703 
704  /** \brief Constructor resulting in an invalid circulator. */
706 
707  /** \brief Construct from the face around which we want to circulate. */
708  OuterHalfEdgeAroundFaceCirculator(const FaceIndex& idx_face, Mesh* const mesh)
709  : mesh_(mesh), idx_inner_half_edge_(mesh->getInnerHalfEdgeIndex(idx_face))
710  {}
711 
712  /** \brief Construct directly from the inner half-edge. */
714  Mesh* const mesh)
715  : mesh_(mesh), idx_inner_half_edge_(idx_inner_half_edge)
716  {}
717 
718  /** \brief Check if the circulator is valid.
719  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure
720  * this yourself when constructing the circulator. */
721  inline bool
722  isValid() const
723  {
724  return (idx_inner_half_edge_.isValid());
725  }
726 
727  /** \brief Comparison operators (with boost::operators): == !=
728  * \warning Does NOT check if the circulators belong to the same mesh. Please check
729  * this yourself. */
730  inline bool
731  operator==(const Self& other) const
732  {
733  return (idx_inner_half_edge_ == other.idx_inner_half_edge_);
734  }
735 
736  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
737  inline Self&
739  {
740  idx_inner_half_edge_ = mesh_->getNextHalfEdgeIndex(idx_inner_half_edge_);
741  return (*this);
742  }
743 
744  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
745  inline Self&
747  {
748  idx_inner_half_edge_ = mesh_->getPrevHalfEdgeIndex(idx_inner_half_edge_);
749  return (*this);
750  }
751 
752  /** \brief Get the index to the outer half-edge. */
753  inline HalfEdgeIndex
755  {
756  return (mesh_->getOppositeHalfEdgeIndex(idx_inner_half_edge_));
757  }
758 
759  /** \brief Get the half-edge that is currently stored in the circulator. */
760  inline HalfEdgeIndex
762  {
763  return (idx_inner_half_edge_);
764  }
765 
766  /** \brief The mesh to which this circulator belongs to. */
768 
769  /** \brief The inner half-edge of the face around which we want to circulate. */
771 };
772 } // End namespace geometry
773 } // End namespace pcl
774 
775 ////////////////////////////////////////////////////////////////////////////////
776 // FaceAroundFaceCirculator
777 ////////////////////////////////////////////////////////////////////////////////
778 
779 namespace pcl {
780 namespace geometry {
781 /** \brief Circulates clockwise around a face and returns an index to the face of the
782  * outer half-edge (the target). The best way to declare the circulator is to use the
783  * method pcl::geometry::MeshBase::getFaceAroundFaceCirculator ().
784  * \tparam MeshT Mesh to which this circulator belongs to.
785  * \note The circulator can't be used to change the connectivity in the mesh (only
786  * const circulators are valid).
787  * \author Martin Saelzle
788  * \ingroup geometry
789  */
790 template <class MeshT>
792 : boost::equality_comparable<
793  pcl::geometry::FaceAroundFaceCirculator<MeshT>,
794  boost::unit_steppable<pcl::geometry::FaceAroundFaceCirculator<MeshT>>> {
795 public:
796  using Base = boost::equality_comparable<
798  boost::unit_steppable<pcl::geometry::FaceAroundFaceCirculator<MeshT>>>;
799  using Self = pcl::geometry::FaceAroundFaceCirculator<MeshT>;
800 
801  using Mesh = MeshT;
802  using FaceIndex = typename Mesh::FaceIndex;
804 
805  /** \brief Constructor resulting in an invalid circulator. */
807 
808  /** \brief Construct from the face around which we want to circulate. */
809  FaceAroundFaceCirculator(const FaceIndex& idx_face, Mesh* const mesh)
810  : mesh_(mesh), idx_inner_half_edge_(mesh->getInnerHalfEdgeIndex(idx_face))
811  {}
812 
813  /** \brief Construct directly from the inner half-edge. */
814  FaceAroundFaceCirculator(const HalfEdgeIndex& idx_inner_half_edge, Mesh* const mesh)
815  : mesh_(mesh), idx_inner_half_edge_(idx_inner_half_edge)
816  {}
817 
818  /** \brief Check if the circulator is valid.
819  * \warning Does NOT check if the stored mesh pointer is valid. You have to ensure
820  * this yourself when constructing the circulator. */
821  inline bool
822  isValid() const
823  {
824  return (idx_inner_half_edge_.isValid());
825  }
826 
827  /** \brief Comparison operators (with boost::operators): == !=
828  * \warning Does NOT check if the circulators belong to the same mesh. Please check
829  * this yourself. */
830  inline bool
831  operator==(const Self& other) const
832  {
833  return (idx_inner_half_edge_ == other.idx_inner_half_edge_);
834  }
835 
836  /** \brief Increment operators (with boost::operators): ++ (pre and post) */
837  inline Self&
839  {
840  idx_inner_half_edge_ = mesh_->getNextHalfEdgeIndex(idx_inner_half_edge_);
841  return (*this);
842  }
843 
844  /** \brief Decrement operators (with boost::operators): -- (pre and post) */
845  inline Self&
847  {
848  idx_inner_half_edge_ = mesh_->getPrevHalfEdgeIndex(idx_inner_half_edge_);
849  return (*this);
850  }
851 
852  /** \brief Get the index to the target face. */
853  inline FaceIndex
855  {
856  return (mesh_->getOppositeFaceIndex(idx_inner_half_edge_));
857  }
858 
859  /** \brief Get the half-edge that is currently stored in the circulator. */
860  inline HalfEdgeIndex
862  {
863  return (idx_inner_half_edge_);
864  }
865 
866  /** \brief The mesh to which this circulator belongs to. */
868 
869  /** \brief The inner half-edge of the face around which we want to circulate. */
871 };
872 } // End namespace geometry
873 } // End namespace pcl
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
bool isValid() const
Check if the circulator is valid.
boost::equality_comparable< pcl::geometry::OuterHalfEdgeAroundFaceCirculator< MeshT >, boost::unit_steppable< pcl::geometry::OuterHalfEdgeAroundFaceCirculator< MeshT >>> Base
pcl::geometry::InnerHalfEdgeAroundFaceCirculator< MeshT > Self
Definition: surface.h:13
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
typename Mesh::HalfEdgeIndex HalfEdgeIndex
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)
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
pcl::detail::MeshIndex< struct FaceIndexTag > FaceIndex
Index used to access elements in the half-edge mesh.
Definition: mesh_indices.h:211
boost::equality_comparable< pcl::geometry::IncomingHalfEdgeAroundVertexCirculator< MeshT >, boost::unit_steppable< pcl::geometry::IncomingHalfEdgeAroundVertexCirculator< MeshT >>> Base
pcl::geometry::OuterHalfEdgeAroundFaceCirculator< MeshT > Self
FaceAroundVertexCirculator(const VertexIndex &idx_vertex, Mesh *const mesh)
Construct from the vertex around which we want to circulate.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
HalfEdgeIndex idx_incoming_half_edge_
The incoming half-edge of the vertex around which we want to circulate.
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.
Circulates clockwise around a face and returns an index to the face of the outer half-edge (the targe...
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
Circulates counter-clockwise around a vertex and returns an index to the incoming half-edge (the targ...
OutgoingHalfEdgeAroundVertexCirculator(const VertexIndex &idx_vertex, Mesh *const mesh)
Construct from the vertex around which we want to circulate.
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
FaceIndex getTargetIndex() const
Get the index to the target face.
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
VertexIndex getTargetIndex() const
Get the index to the target vertex.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
Mesh * mesh_
The mesh to which this circulator belongs to.
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
FaceIndex getTargetIndex() const
Get the index to the target face.
Mesh * mesh_
The mesh to which this circulator belongs to.
IncomingHalfEdgeAroundVertexCirculator(const HalfEdgeIndex &idx_incoming_half_edge, Mesh *const mesh)
Construct directly from the incoming half-edge.
bool isValid() const
Check if the circulator is valid.
VertexAroundFaceCirculator(const HalfEdgeIndex &idx_inner_half_edge, Mesh *const mesh)
Construct directly from the inner half-edge.
Mesh * mesh_
The mesh to which this circulator belongs to.
pcl::geometry::IncomingHalfEdgeAroundVertexCirculator< MeshT > Self
VertexAroundVertexCirculator(const VertexIndex &idx_vertex, Mesh *const mesh)
Construct from the vertex around which we want to circulate.
boost::equality_comparable< pcl::geometry::FaceAroundFaceCirculator< MeshT >, boost::unit_steppable< pcl::geometry::FaceAroundFaceCirculator< MeshT >>> Base
OutgoingHalfEdgeAroundVertexCirculator(const HalfEdgeIndex &idx_outgoing_half_edge, Mesh *const mesh)
Construct directly from the outgoing half-edge.
OuterHalfEdgeAroundFaceCirculator(const FaceIndex &idx_face, Mesh *const mesh)
Construct from the face around which we want to circulate.
Mesh * mesh_
The mesh to which this circulator belongs to.
InnerHalfEdgeAroundFaceCirculator(const HalfEdgeIndex &idx_inner_half_edge, Mesh *const mesh)
Construct directly from the inner half-edge.
boost::equality_comparable< pcl::geometry::VertexAroundFaceCirculator< MeshT >, boost::unit_steppable< pcl::geometry::VertexAroundFaceCirculator< MeshT >>> Base
HalfEdgeIndex idx_inner_half_edge_
The inner half-edge of the face around which we want to circulate.
FaceAroundFaceCirculator()
Constructor resulting in an invalid circulator.
Circulates counter-clockwise around a vertex and returns an index to the terminating vertex of the ou...
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): == !=.
Mesh * mesh_
The mesh to which this circulator belongs to.
VertexIndex getTargetIndex() const
Get the index to the target vertex.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
Circulates clockwise around a face and returns an index to the terminating vertex of the inner half-e...
pcl::detail::MeshIndex< struct HalfEdgeIndexTag > HalfEdgeIndex
Index used to access elements in the half-edge mesh.
Definition: mesh_indices.h:199
HalfEdgeIndex idx_outgoing_half_edge_
The outgoing half-edge of the vertex around which we want to circulate.
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
Mesh * mesh_
The mesh to which this circulator belongs to.
HalfEdgeIndex idx_inner_half_edge_
The inner half-edge of the face around which we want to circulate.
typename Mesh::HalfEdgeIndex HalfEdgeIndex
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
typename Mesh::HalfEdgeIndex HalfEdgeIndex
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)
boost::equality_comparable< pcl::geometry::VertexAroundVertexCirculator< MeshT >, boost::unit_steppable< pcl::geometry::VertexAroundVertexCirculator< MeshT >>> Base
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
bool isValid() const
Check if the circulator is valid.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
boost::equality_comparable< pcl::geometry::FaceAroundVertexCirculator< MeshT >, boost::unit_steppable< pcl::geometry::FaceAroundVertexCirculator< MeshT >>> Base
VertexAroundFaceCirculator(const FaceIndex &idx_face, Mesh *const mesh)
Construct from the face around which we want to circulate.
bool isValid() const
Check if the circulator is valid.
HalfEdgeIndex getTargetIndex() const
Get the index to the inner half-edge.
boost::equality_comparable< pcl::geometry::InnerHalfEdgeAroundFaceCirculator< MeshT >, boost::unit_steppable< pcl::geometry::InnerHalfEdgeAroundFaceCirculator< MeshT >>> Base
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
pcl::geometry::VertexAroundFaceCirculator< MeshT > Self
OuterHalfEdgeAroundFaceCirculator()
Constructor resulting in an invalid circulator.
HalfEdgeIndex getTargetIndex() const
Get the index to the outer half-edge.
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
InnerHalfEdgeAroundFaceCirculator(const FaceIndex &idx_face, Mesh *const mesh)
Construct from the face around which we want to circulate.
VertexAroundVertexCirculator()
Constructor resulting in an invalid circulator.
InnerHalfEdgeAroundFaceCirculator()
Constructor resulting in an invalid circulator.
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
FaceAroundFaceCirculator(const HalfEdgeIndex &idx_inner_half_edge, Mesh *const mesh)
Construct directly from the inner half-edge.
Mesh * mesh_
The mesh to which this circulator belongs to.
boost::equality_comparable< pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator< MeshT >, boost::unit_steppable< pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator< MeshT >>> Base
bool isValid() const
Check if the circulator is valid.
pcl::geometry::FaceAroundFaceCirculator< MeshT > Self
Mesh * mesh_
The mesh to which this circulator belongs to.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
typename Mesh::HalfEdgeIndex HalfEdgeIndex
Circulates clockwise around a face and returns an index to the inner half-edge (the target)...
pcl::geometry::FaceAroundVertexCirculator< MeshT > Self
bool isValid() const
Check if the circulator is valid.
VertexAroundFaceCirculator()
Constructor resulting in an invalid circulator.
HalfEdgeIndex idx_outgoing_half_edge_
The outgoing half-edge of the vertex around which we want to circulate.
pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator< MeshT > Self
Circulates clockwise around a face and returns an index to the outer half-edge (the target)...
Circulates counter-clockwise around a vertex and returns an index to the face of the outgoing half-ed...
FaceAroundFaceCirculator(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.
IncomingHalfEdgeAroundVertexCirculator(const VertexIndex &idx_vertex, Mesh *const mesh)
Construct from the vertex around which we want to circulate.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
HalfEdgeIndex getCurrentHalfEdgeIndex() const
Get the half-edge that is currently stored in the circulator.
IncomingHalfEdgeAroundVertexCirculator()
Constructor resulting in an invalid circulator.
OuterHalfEdgeAroundFaceCirculator(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): == !=.
HalfEdgeIndex idx_outgoing_half_edge_
The outgoing half-edge of the vertex around which we want to circulate.
HalfEdgeIndex getTargetIndex() const
Get the index to the incoming half-edge.
OutgoingHalfEdgeAroundVertexCirculator()
Constructor resulting in an invalid circulator.
pcl::detail::MeshIndex< struct VertexIndexTag > VertexIndex
Index used to access elements in the half-edge mesh.
Definition: mesh_indices.h:193
HalfEdgeIndex getTargetIndex() const
Get the index to the outgoing half-edge.
FaceAroundVertexCirculator()
Constructor resulting in an invalid circulator.
Self & operator--()
Decrement operators (with boost::operators): – (pre and post)
VertexAroundVertexCirculator(const HalfEdgeIndex &idx_outgoing_half_edge, Mesh *const mesh)
Construct directly from the outgoing half-edge.
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
bool isValid() const
Check if the circulator is valid.
pcl::geometry::VertexAroundVertexCirculator< MeshT > Self