EBGeometry 1.0
Loading...
Searching...
No Matches
EBGeometry_Triangle.hpp
Go to the documentation of this file.
1/* EBGeometry
2 * Copyright © 2024 Robert Marskar
3 * Please refer to Copyright.txt and LICENSE in the EBGeometry root directory.
4 */
5
12#ifndef EBGeometry_Triangle
13#define EBGeometry_Triangle
14
15// Std includes
16#include <array>
17
18// Our includes
19#include "EBGeometry_Vec.hpp"
21
22namespace EBGeometry {
23
47 template <class T, class Meta>
49 {
50 public:
54 using Vec2 = Vec2T<T>;
55
59 using Vec3 = Vec3T<T>;
60
65
71
77
82
89
96
101 void
103
108 void
110
115 void
117
122 void
124
129 void
131
136 void
138
143 Vec3&
145
150 const Vec3&
152
157 std::array<Vec3, 3>&
159
164 const std::array<Vec3, 3>&
166
171 std::array<Vec3, 3>&
173
178 const std::array<Vec3, 3>&
180
185 std::array<Vec3, 3>&
187
192 const std::array<Vec3, 3>&
194
199 Meta&
201
206 const Meta&
208
213 T
215
216 protected:
221
226
230 std::array<Vec3, 3> m_vertexNormals{Vec3::max(), Vec3::max(), Vec3::max()};
234 std::array<Vec3, 3> m_edgeNormals{Vec3::max(), Vec3::max(), Vec3::max()};
235
240
245
255 T
256 projectPointToEdge(const Vec3& a_point, const Vec3& a_x0, const Vec3& a_x1) const noexcept;
257 };
258} // namespace EBGeometry
259
260#include "EBGeometry_TriangleImplem.hpp" // NOLINT
261
262#endif
Declaration of a class that encapsulates the projection of a 3D triangle into a 2D plane.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Vec2T< T > max(const Vec2T< T > &u, const Vec2T< T > &v) noexcept
Maximum function. Returns new vector with component-wise minimums.
Triangle class with signed distance functionality.
Definition EBGeometry_Triangle.hpp:49
std::array< Vec3, 3 > & getVertexNormals() noexcept
Get the vertex normals.
std::array< Vec3, 3 > & getEdgeNormals() noexcept
Get the edge normals.
std::array< Vec3, 3 > & getVertexPositions() noexcept
Get the vertex positions.
void setNormal(const Vec3 &a_normal) noexcept
Set the triangle normal vector.
std::array< Vec3, 3 > m_edgeNormals
Triangle edge normals.
Definition EBGeometry_Triangle.hpp:234
std::array< Vec3, 3 > m_vertexNormals
Triangle vertex normals.
Definition EBGeometry_Triangle.hpp:230
T projectPointToEdge(const Vec3 &a_point, const Vec3 &a_x0, const Vec3 &a_x1) const noexcept
Returns the "projection" of a point to an edge.
Vec3 m_triangleNormal
Triangle face normal.
Definition EBGeometry_Triangle.hpp:220
void setEdgeNormals(const std::array< Vec3, 3 > &a_edgeNormals) noexcept
Set the triangle edge normals.
Triangle2D< T > m_triangle2D
2D projection of the triangle to one of the Cartesian coordinate directions
Definition EBGeometry_Triangle.hpp:239
Meta & getMetaData() noexcept
Get the triangle meta-data.
void computeNormal() noexcept
Compute the triangle normal vector.
void setMetaData(const Meta &a_metaData) noexcept
Set the triangle meta-data.
Meta m_metaData
Triangle meta-data normals.
Definition EBGeometry_Triangle.hpp:244
std::array< Vec3, 3 > m_vertexPositions
Triangle vertex positions.
Definition EBGeometry_Triangle.hpp:225
void setVertexNormals(const std::array< Vec3, 3 > &a_vertexNormals) noexcept
Set the triangle vertex normals.
Vec3 & getNormal() noexcept
Get the triangle normal vector.
T signedDistance(const Vec3 &a_point) const noexcept
Compute the signed distance from the input point x to the triangle.
Triangle() noexcept=default
Default constructor. Does not put the triangle in a usable state.
void setVertexPositions(const std::array< Vec3, 3 > &a_vertexPositions) noexcept
Set the triangle vertex positions.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:218
static constexpr Vec3T< T > max() noexcept
Return a vector with maximum representable components.
Name space for all of EBGeometry.
Definition EBGeometry.hpp:23