EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_DCEL_Vertex.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_VERTEX_HPP
13#define EBGEOMETRY_DCEL_VERTEX_HPP
14
15// Std includes
16#include <memory>
17#include <type_traits>
18#include <vector>
19
20// Our includes
21#include "EBGeometry_DCEL.hpp"
23#include "EBGeometry_Vec.hpp"
24
25namespace EBGeometry {
26
27namespace DCEL {
28
41template <class T, class Meta>
43{
44 static_assert(std::is_floating_point_v<T>, "VertexT<T,Meta>: T must be a floating-point type");
45
46public:
50 using Vec3 = Vec3T<T>;
51
56
61
66
70 using VertexPtr = std::shared_ptr<Vertex>;
71
75 using EdgePtr = std::shared_ptr<Edge>;
76
80 using FacePtr = std::shared_ptr<Face>;
81
86
94 VertexT() = default;
95
103
112
126
139
143 ~VertexT() = default;
144
153 Vertex&
155
163 Vertex&
165
173 inline void
174 define(const Vec3& a_position, const EdgePtr& a_edge, const Vec3& a_normal) noexcept;
175
180 inline void
181 setPosition(const Vec3& a_position) noexcept;
182
187 inline void
188 setNormal(const Vec3& a_normal) noexcept;
189
194 inline void
195 setEdge(const EdgePtr& a_edge) noexcept;
196
201 inline void
202 setMetaData(const Meta& a_metaData) noexcept;
203
208 inline void
210
216 inline void
218
223 inline void
225
232 inline void
234
243 inline void
245
254 inline void
256
260 inline void
262
267 [[nodiscard]] inline Vec3T<T>&
269
276
281 [[nodiscard]] inline Vec3T<T>&
283
290
300
307
312 [[nodiscard]] inline std::vector<FacePtr>&
314
319 [[nodiscard]] inline const std::vector<FacePtr>&
321
328 [[nodiscard]] inline T
330
338 [[nodiscard]] inline T
340
347
354
363 std::weak_ptr<Edge> m_outgoingEdge;
364
369
374
380 std::vector<FacePtr> m_faces;
381
389};
390} // namespace DCEL
391
392} // namespace EBGeometry
393
394#include "EBGeometry_DCEL_VertexImplem.hpp"
395
396#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.
Vertex class for navigating a DCEL mesh.
Definition EBGeometry_DCEL_Vertex.hpp:43
std::shared_ptr< Face > FacePtr
Alias for face pointer type.
Definition EBGeometry_DCEL_Vertex.hpp:80
VertexT(Vertex &&a_otherVertex)=default
Move constructor.
void normalizeNormalVector() noexcept
Normalize the normal vector, ensuring its length is 1.
T signedDistance(const Vec3 &a_x0) const noexcept
Get the signed distance to this vertex.
void setNormal(const Vec3 &a_normal) noexcept
Set the vertex normal vector.
VertexT(const Vec3 &a_position)
Partial constructor.
std::vector< FacePtr > & getFaces() noexcept
Get modifiable polygon face list for this vertex.
std::shared_ptr< Edge > EdgePtr
Alias for edge pointer type.
Definition EBGeometry_DCEL_Vertex.hpp:75
void computeVertexNormalAverage() noexcept
Compute the vertex normal, using an average the normal vector in this vertex's face list (m_faces)
Vertex & operator=(Vertex &&a_otherVertex)=default
Move assignment operator.
void setMetaData(const Meta &a_metaData) noexcept
Set the meta-data.
Vertex & operator=(const Vertex &a_otherVertex)
Copy assignment operator.
Meta & getMetaData() noexcept
Get meta-data.
EdgePtr getOutgoingEdge() noexcept
Get the outgoing edge.
std::shared_ptr< Vertex > VertexPtr
Alias for vertex pointer type.
Definition EBGeometry_DCEL_Vertex.hpp:70
std::weak_ptr< Edge > m_outgoingEdge
Pointer to an outgoing edge from this vertex.
Definition EBGeometry_DCEL_Vertex.hpp:363
VertexT(const Vertex &a_otherVertex)
Copy constructor.
Vec3 m_position
Vertex position.
Definition EBGeometry_DCEL_Vertex.hpp:368
void addFace(const FacePtr &a_face)
Add a face to the polygon face list.
VertexT(const Vec3 &a_position, const Vec3 &a_normal)
Constructor.
Vec3T< T > & getNormal() noexcept
Return modifiable vertex normal vector.
std::vector< FacePtr > m_faces
List of faces connected to this vertex.
Definition EBGeometry_DCEL_Vertex.hpp:380
void computeVertexNormalAngleWeighted()
Compute the vertex normal, using the pseudonormal algorithm which weights the normal with the subtend...
Vec3T< T > & getPosition() noexcept
Return modifiable vertex position.
void flipNormal() noexcept
Flip the normal vector.
void define(const Vec3 &a_position, const EdgePtr &a_edge, const Vec3 &a_normal) noexcept
Define function.
void setPosition(const Vec3 &a_position) noexcept
Set the vertex position.
T unsignedDistance2(const Vec3 &a_x0) const noexcept
Get the squared unsigned distance to this vertex.
void setEdge(const EdgePtr &a_edge) noexcept
Set the reference to the outgoing edge.
Meta m_metaData
Meta-data for this vertex.
Definition EBGeometry_DCEL_Vertex.hpp:388
VertexT()=default
Default constructor.
Vec3 m_normal
Vertex normal vector.
Definition EBGeometry_DCEL_Vertex.hpp:373
~VertexT()=default
Destructor (does nothing)
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31