EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_Triangle.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
11#ifndef EBGEOMETRY_TRIANGLE_HPP
12#define EBGEOMETRY_TRIANGLE_HPP
13
14// Std includes
15#include <array>
16#include <type_traits>
17
18// Our includes
19#include "EBGeometry_Vec.hpp"
20
21namespace EBGeometry {
22
46template <class T, class Meta>
48{
49 static_assert(std::is_floating_point_v<T>, "T must be a floating-point type");
50
51public:
55 using Vec2 = Vec2T<T>;
56
60 using Vec3 = Vec3T<T>;
61
66
72
78
84
89
97
103 Triangle&
105
111 void
113
121 void
123
128 void
130
135 void
137
142 void
144
151 void
153
160 [[nodiscard]] const Vec3&
162
169 [[nodiscard]] const std::array<Vec3, 3>&
171
177 [[nodiscard]] const std::array<Vec3, 3>&
179
185 [[nodiscard]] const std::array<Vec3, 3>&
187
193 [[nodiscard]] const Meta&
195
203 [[nodiscard]] T
205
211
216
220 std::array<Vec3, 3> m_vertexNormals{Vec3::max(), Vec3::max(), Vec3::max()};
221
225 std::array<Vec3, 3> m_edgeNormals{Vec3::max(), Vec3::max(), Vec3::max()};
226
231};
232} // namespace EBGeometry
233
234#include "EBGeometry_TriangleImplem.hpp" // NOLINT
235
236#endif
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Triangle class with signed distance functionality.
Definition EBGeometry_Triangle.hpp:48
const std::array< Vec3, 3 > & getVertexNormals() const noexcept
Get the vertex normals.
void setNormal(const Vec3 &a_normal) noexcept
Set the triangle normal vector.
const std::array< Vec3, 3 > & getVertexPositions() const noexcept
Get the vertex positions.
std::array< Vec3, 3 > m_edgeNormals
Triangle edge normals.
Definition EBGeometry_Triangle.hpp:225
const std::array< Vec3, 3 > & getEdgeNormals() const noexcept
Get the edge normals.
std::array< Vec3, 3 > m_vertexNormals
Triangle vertex normals.
Definition EBGeometry_Triangle.hpp:220
const Meta & getMetaData() const noexcept
Get the triangle meta-data.
Vec3 m_triangleNormal
Triangle face normal.
Definition EBGeometry_Triangle.hpp:210
void setEdgeNormals(const std::array< Vec3, 3 > &a_edgeNormals) noexcept
Set the triangle edge normals.
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:230
std::array< Vec3, 3 > m_vertexPositions
Triangle vertex positions.
Definition EBGeometry_Triangle.hpp:215
void setVertexNormals(const std::array< Vec3, 3 > &a_vertexNormals) noexcept
Set the triangle vertex normals.
const Vec3 & getNormal() const 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:225
static constexpr Vec3T< T > max() noexcept
Return the most-positive representable vector.
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31
Vec2T< T > max(const Vec2T< T > &u, const Vec2T< T > &v) noexcept
Component-wise maximum of two vectors.