EBGeometry  1.0
EBGeometry_DCEL_Edge.hpp
Go to the documentation of this file.
1 /* EBGeometry
2  * Copyright © 2022 Robert Marskar
3  * Please refer to Copyright.txt and LICENSE in the EBGeometry root directory.
4  */
5 
13 #ifndef EBGeometry_DCEL_Edge
14 #define EBGeometry_DCEL_Edge
15 
16 // Std includes
17 #include <vector>
18 #include <memory>
19 
20 // Our includes
21 #include "EBGeometry_Vec.hpp"
22 #include "EBGeometry_DCEL_Face.hpp"
24 
25 namespace DCEL {
26 
45  template <class T, class Meta>
46  class EdgeT
47  {
48  public:
52  using Vec3 = Vec3T<T>;
53 
58 
63 
68 
72  using VertexPtr = std::shared_ptr<Vertex>;
73 
77  using EdgePtr = std::shared_ptr<Edge>;
78 
82  using FacePtr = std::shared_ptr<Face>;
83 
88  EdgeT();
89 
94  EdgeT(const Edge& a_otherEdge);
95 
101  EdgeT(const VertexPtr& a_vertex);
102 
106  virtual ~EdgeT();
107 
111  inline size_t
112  size() const noexcept;
113 
120  inline void
121  define(const VertexPtr& a_vertex, const EdgePtr& a_pairEdge, const EdgePtr& a_nextEdge) noexcept;
122 
127  inline void
128  reconcile() noexcept;
129 
133  inline void
134  flip() noexcept;
135 
140  inline void
141  setVertex(const VertexPtr& a_vertex) noexcept;
142 
147  inline void
148  setPairEdge(const EdgePtr& a_pairEdge) noexcept;
149 
154  inline void
155  setNextEdge(const EdgePtr& a_nextEdge) noexcept;
156 
160  inline void
161  setFace(const FacePtr& a_face) noexcept;
162 
167  inline VertexPtr&
168  getVertex() noexcept;
169 
174  inline const VertexPtr&
175  getVertex() const noexcept;
176 
181  inline VertexPtr&
182  getOtherVertex() noexcept;
183 
188  inline const VertexPtr&
189  getOtherVertex() const noexcept;
190 
195  inline EdgePtr&
196  getPairEdge() noexcept;
197 
202  inline const EdgePtr&
203  getPairEdge() const noexcept;
204 
209  inline EdgePtr&
210  getNextEdge() noexcept;
211 
216  inline const EdgePtr&
217  getNextEdge() const noexcept;
218 
222  inline Vec3T<T>
223  computeNormal() const noexcept;
224 
228  inline const Vec3T<T>&
229  getNormal() const noexcept;
230 
234  inline FacePtr&
235  getFace() noexcept;
236 
240  inline const FacePtr&
241  getFace() const noexcept;
242 
247  inline Meta&
248  getMetaData() noexcept;
249 
254  inline const Meta&
255  getMetaData() const noexcept;
256 
264  inline T
265  signedDistance(const Vec3& a_x0) const noexcept;
266 
275  inline T
276  unsignedDistance2(const Vec3& a_x0) const noexcept;
277 
278  protected:
283 
288 
293 
298 
303 
308 
315  inline T
316  projectPointToEdge(const Vec3& a_x0) const noexcept;
317 
321  inline Vec3T<T>
322  getX2X1() const noexcept;
323  };
324 } // namespace DCEL
325 
326 #include "EBGeometry_NamespaceFooter.hpp"
327 
328 #include "EBGeometry_DCEL_EdgeImplem.hpp"
329 
330 #endif
Declaration of a polygon face class for use in DCEL descriptions of polygon tesselations.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Edge class.
Definition: EBGeometry_DCEL_Edge.hpp:47
EdgePtr m_nextEdge
Next edge.
Definition: EBGeometry_DCEL_Edge.hpp:297
Meta & getMetaData() noexcept
Get meta-data.
Vec3T< T > computeNormal() const noexcept
Compute the normal vector.
const Vec3T< T > & getNormal() const noexcept
Get the normal vector.
VertexPtr & getVertex() noexcept
Get modifiable starting vertex.
T projectPointToEdge(const Vec3 &a_x0) const noexcept
Returns the "projection" of a point to an edge.
EdgeT(const VertexPtr &a_vertex)
Partial constructor. Calls the default constructor but sets the starting vertex.
VertexPtr m_vertex
Starting vertex.
Definition: EBGeometry_DCEL_Edge.hpp:287
EdgeT(const Edge &a_otherEdge)
Copy constructor. Copies all information from the other half-edge.
void reconcile() noexcept
Reconcile internal logic.
std::shared_ptr< Edge > EdgePtr
Alias for edge pointer type.
Definition: EBGeometry_DCEL_Edge.hpp:77
void setNextEdge(const EdgePtr &a_nextEdge) noexcept
Set the next edge.
std::shared_ptr< Face > FacePtr
Alias for face pointer type.
Definition: EBGeometry_DCEL_Edge.hpp:82
void setFace(const FacePtr &a_face) noexcept
Set the pointer to this half-edge's face.
VertexPtr & getOtherVertex() noexcept
Get modifiable end vertex.
EdgeT()
Default constructor. Sets all pointers to zero and vectors to zero vectors.
Meta m_metaData
Meta-data attached to this edge.
Definition: EBGeometry_DCEL_Edge.hpp:307
FacePtr & getFace() noexcept
Get modifiable half-edge face.
void setPairEdge(const EdgePtr &a_pairEdge) noexcept
Set the pair edge.
Vec3 m_normal
Normal vector.
Definition: EBGeometry_DCEL_Edge.hpp:282
EdgePtr & getPairEdge() noexcept
Get modifiable pair edge.
void define(const VertexPtr &a_vertex, const EdgePtr &a_pairEdge, const EdgePtr &a_nextEdge) noexcept
Define function. Sets the starting vertex, edges, and normal vectors.
T signedDistance(const Vec3 &a_x0) const noexcept
Get the signed distance to this half edge.
EdgePtr & getNextEdge() noexcept
Get modifiable next edge.
std::shared_ptr< Vertex > VertexPtr
Alias for vertex pointer type.
Definition: EBGeometry_DCEL_Edge.hpp:72
T unsignedDistance2(const Vec3 &a_x0) const noexcept
Get the signed distance to this half edge.
FacePtr m_face
Enclosing polygon face.
Definition: EBGeometry_DCEL_Edge.hpp:302
void setVertex(const VertexPtr &a_vertex) noexcept
Set the starting vertex.
virtual ~EdgeT()
Destructor (does nothing)
size_t size() const noexcept
Get size (in bytes) of this object.
Vec3T< T > getX2X1() const noexcept
Get the vector pointing along this edge.
void flip() noexcept
Flip surface normal.
EdgePtr m_pairEdge
Pair edge.
Definition: EBGeometry_DCEL_Edge.hpp:292
Face class.
Definition: EBGeometry_DCEL_Face.hpp:49
Vertex class.
Definition: EBGeometry_DCEL_Vertex.hpp:40
Three-dimensional vector class with arithmetic operators.
Definition: EBGeometry_Vec.hpp:218
Namespace containing various double-connected edge list (DCEL) functionality.