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