EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_DCEL_Edge.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
12#ifndef EBGEOMETRY_DCEL_EDGE_HPP
13#define EBGEOMETRY_DCEL_EDGE_HPP
14
15// Std includes
16#include <cstddef>
17#include <memory>
18#include <type_traits>
19
20// Our includes
21#include "EBGeometry_DCEL.hpp"
23#include "EBGeometry_Vec.hpp"
24
25namespace EBGeometry {
26
27namespace DCEL {
28
49template <class T, class Meta>
50class EdgeT
51{
52 static_assert(std::is_floating_point_v<T>, "EdgeT<T,Meta>: T must be a floating-point type");
53
54public:
58 using Vec3 = Vec3T<T>;
59
64
69
74
78 using VertexPtr = std::shared_ptr<Vertex>;
79
83 using EdgePtr = std::shared_ptr<Edge>;
84
88 using FacePtr = std::shared_ptr<Face>;
89
95
109
121
128
133
142 Edge&
144
152 Edge&
154
159 [[nodiscard]] inline size_t
161
168 inline void
170
175 inline void
177
181 inline void
183
188 inline void
190
195 inline void
197
202 inline void
204
209 inline void
211
216 inline void
218
228
235
242
249
256
263
270
277
283 [[nodiscard]] inline Vec3T<T>
285
290 [[nodiscard]] inline Vec3T<T>&
292
299
306
313
320
327
336 [[nodiscard]] inline T
338
347 [[nodiscard]] inline T
349
354 Vec3 m_normal = Vec3::zeros();
355
363 std::weak_ptr<Vertex> m_vertex;
364
368 std::weak_ptr<Edge> m_pairEdge;
369
373 std::weak_ptr<Edge> m_nextEdge;
374
378 std::weak_ptr<Face> m_face;
379
387
396 [[nodiscard]] inline T
397 projectPointToEdge(const Vec3& a_x0) const noexcept;
398
404 [[nodiscard]] inline Vec3T<T>
406};
407} // namespace DCEL
408
409} // namespace EBGeometry
410
411#include "EBGeometry_DCEL_EdgeImplem.hpp"
412
413#endif
Namespace documentation.
Declaration of a polygon face class for use in DCEL descriptions of polygon tessellations.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Half-edge class for navigating a DCEL mesh.
Definition EBGeometry_DCEL_Edge.hpp:51
T signedDistance(const Vec3 &a_x0) const noexcept
Get the signed distance from a_x0 to this half-edge.
Vec3T< T > & getNormal() noexcept
Get modifiable normal vector.
EdgePtr getNextEdge() noexcept
Get the next edge.
void setNextEdge(const EdgePtr &a_nextEdge) noexcept
Set the next edge.
VertexPtr getVertex() noexcept
Get the starting vertex.
VertexPtr getOtherVertex() noexcept
Get the end vertex.
void reconcile() noexcept
Reconcile internal logic.
Vec3T< T > getX2X1() const noexcept
Get the vector pointing along this edge (from start to end vertex).
std::weak_ptr< Edge > m_nextEdge
Next edge. See m_vertex for why this is a weak_ptr.
Definition EBGeometry_DCEL_Edge.hpp:373
std::shared_ptr< Vertex > VertexPtr
Alias for vertex pointer type.
Definition EBGeometry_DCEL_Edge.hpp:78
std::weak_ptr< Face > m_face
Enclosing polygon face. See m_vertex for why this is a weak_ptr.
Definition EBGeometry_DCEL_Edge.hpp:378
void setMetaData(const Meta &a_metaData) noexcept
Set the meta-data.
Meta m_metaData
Meta-data attached to this edge.
Definition EBGeometry_DCEL_Edge.hpp:386
std::weak_ptr< Edge > m_pairEdge
Pair edge. See m_vertex for why this is a weak_ptr.
Definition EBGeometry_DCEL_Edge.hpp:368
std::shared_ptr< Edge > EdgePtr
Alias for edge pointer type.
Definition EBGeometry_DCEL_Edge.hpp:83
Meta & getMetaData() noexcept
Get meta-data.
void setVertex(const VertexPtr &a_vertex) noexcept
Set the starting vertex.
EdgeT() noexcept=default
Default constructor. Sets all pointers to zero and vectors to zero vectors.
std::weak_ptr< Vertex > m_vertex
Starting vertex.
Definition EBGeometry_DCEL_Edge.hpp:363
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.
void setFace(const FacePtr &a_face) noexcept
Set the pointer to this half-edge's face.
FacePtr getFace() noexcept
Get this half-edge's face.
T unsignedDistance2(const Vec3 &a_x0) const noexcept
Get the squared unsigned distance from a_x0 to this half-edge.
void setPairEdge(const EdgePtr &a_pairEdge) noexcept
Set the pair edge.
std::shared_ptr< Face > FacePtr
Alias for face pointer type.
Definition EBGeometry_DCEL_Edge.hpp:88
size_t size() const noexcept
Get size (in bytes) of this object.
Vec3T< T > computeNormal() const noexcept
Compute the normal vector as the average of the face normals on both sides of this edge.
T projectPointToEdge(const Vec3 &a_x0) const noexcept
Returns the parametric projection of a_x0 onto this edge.
EdgePtr getPairEdge() noexcept
Get the pair edge.
void flipNormal() noexcept
Flip surface normal.
Vec3 m_normal
Normal vector.
Definition EBGeometry_DCEL_Edge.hpp:354
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31