HalfEdge.hpp
Go to the documentation of this file.
1 
28 /*
29  * HalfEdge.hpp
30  *
31  * @date 02.06.2017
32  * @author Lukas Kalbertodt <lukas.kalbertodt@gmail.com>
33  */
34 
35 #ifndef LVR2_GEOMETRY_HALFEDGE_H_
36 #define LVR2_GEOMETRY_HALFEDGE_H_
37 
38 #include <utility>
39 
40 #include "BaseMesh.hpp"
41 #include "Handles.hpp"
42 
43 namespace lvr2
44 {
45 
46 // We need a specific handle for half edges. The `BaseMesh` interface talks
47 // about simple (full) edges. To avoid confusion, this HalfEdgeHandle is used
48 // internally in the HEM. The edge handles given out by the HEM implementation
49 // are handles to the half edge with the lower index.
50 
52 class HalfEdgeHandle : public BaseHandle<Index>
53 {
54 public:
56 
58  {
59  // The index of an edge handle is always the index of the handle of
60  // one of its half edges
61  return HalfEdgeHandle(eH.idx());
62  }
63 };
64 
66 class OptionalHalfEdgeHandle : public BaseOptionalHandle<Index, HalfEdgeHandle>
67 {
68 public:
72 };
73 
74 struct HalfEdge
75 {
79 
82 
87 
90 
91 private:
95  HalfEdge() : target(0), next(0), twin(0) {}
96 
98  template <typename BaseVecT>
99  friend class HalfEdgeMesh;
100 };
101 
102 
103 inline std::ostream& operator<<(std::ostream& os, const HalfEdgeHandle& h)
104 {
105  os << "HE" << h.idx();
106  return os;
107 }
108 
109 inline std::ostream& operator<<(std::ostream& os, const OptionalHalfEdgeHandle& h)
110 {
111  if (h)
112  {
113  os << "HE" << h.unwrap().idx();
114  }
115  else
116  {
117  os << "HE⊥";
118  }
119  return os;
120 }
121 
122 } // namespace lvr2
123 
124 namespace std
125 {
126 
127 template<>
128 struct hash<lvr2::HalfEdgeHandle> {
129  size_t operator()(const lvr2::HalfEdgeHandle& h) const
130  {
131  return std::hash<lvr2::Index>()(h.idx());
132  }
133 };
134 
135 } // namespace std
136 
137 #endif /* LVR2_GEOMETRY_HALFEDGE_H_ */
Handles.hpp
lvr2::HalfEdgeHandle
Handle to access half edges of the HEM.
Definition: HalfEdge.hpp:52
lvr2::OptionalHalfEdgeHandle::OptionalHalfEdgeHandle
OptionalHalfEdgeHandle()
Definition: HalfEdge.hpp:70
lvr2::HalfEdge::face
OptionalFaceHandle face
Definition: HalfEdge.hpp:78
lvr2::HalfEdge::target
VertexHandle target
The vertex this edge points to.
Definition: HalfEdge.hpp:81
lvr2::BaseHandle
Interface for all kinds of handles. Handles are basically a key to refer to something.
Definition: BaseHandle.hpp:54
std::hash< lvr2::HalfEdgeHandle >::operator()
size_t operator()(const lvr2::HalfEdgeHandle &h) const
Definition: HalfEdge.hpp:129
lvr2::operator<<
std::ostream & operator<<(std::ostream &os, const BaseVector< T > &v)
Definition: BaseVector.hpp:227
lvr2::HalfEdge
Definition: HalfEdge.hpp:74
BaseMesh.hpp
lvr2::BaseOptionalHandle::unwrap
NonOptionalT unwrap() const
Extracts the handle. If this doesn't hold a handle (is "None"), this method panics.
lvr2::EdgeHandle
Handle to access edges of the mesh.
Definition: Handles.hpp:134
lvr2::BaseOptionalHandle
Base class for optional handles (handles that can be "null" or "None").
Definition: BaseHandle.hpp:79
lvr2::OptionalFaceHandle
Semantically equivalent to boost::optional<FaceHandle>
Definition: Handles.hpp:170
lvr2::OptionalHalfEdgeHandle
Semantically equivalent to boost::optional<HalfEdgeHandle>
Definition: HalfEdge.hpp:66
lvr2::VertexHandle
Handle to access vertices of the mesh.
Definition: Handles.hpp:146
lvr2::HalfEdge::twin
HalfEdgeHandle twin
The twin edge.
Definition: HalfEdge.hpp:89
lvr2::HalfEdge::next
HalfEdgeHandle next
Definition: HalfEdge.hpp:86
std
Definition: HalfEdge.hpp:124
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::HalfEdge::HalfEdge
HalfEdge()
Initializes all fields with dummy values (unsafe, thus private).
Definition: HalfEdge.hpp:95
lvr2::OptionalHalfEdgeHandle::OptionalHalfEdgeHandle
OptionalHalfEdgeHandle(EdgeHandle eH)
Definition: HalfEdge.hpp:71
lvr2::HalfEdgeHandle::oneHalfOf
static HalfEdgeHandle oneHalfOf(EdgeHandle eH)
Definition: HalfEdge.hpp:57
lvr2::BaseHandle::idx
IdxT idx() const
lvr2::HalfEdgeMesh
Half-edge data structure implementing the BaseMesh interface.
Definition: HalfEdgeMesh.hpp:70


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23