12#ifndef EBGEOMETRY_DCEL_FACE_HPP
13#define EBGEOMETRY_DCEL_FACE_HPP
69 static_assert(std::is_floating_point_v<T>,
"FaceT requires a floating-point T");
164 define(
const Vec3& a_normal,
const uint32_t a_edgeIndex)
noexcept;
245 inline const
Vec3T<T>&
279 inline const
Vec3T<T>&
355 inline std::vector<
Vec3T<T>>
365 inline std::vector<uint32_t>
375 inline std::vector<uint32_t>
543static_assert(std::is_trivially_copyable_v<
FaceT<
float>>, "
FaceT<
float> must be trivially copyable");
544static_assert(std::is_trivially_copyable_v<
FaceT<
double>>, "
FaceT<
double> must be trivially copyable");
550#include "EBGeometry_DCEL_FaceImplem.hpp"
Declaration of a half-edge class for use in DCEL descriptions of polygon tessellations.
Declaration of a vertex class for use in DCEL descriptions of polygon tessellations.
GPU portability layer: host/device decoration macros and backend detection.
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
#define EBGEOMETRY_HOST
Mark a function as callable from host code only (no-op on host compilers).
Definition EBGeometry_GPU.hpp:83
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
Half-edge iterator class for navigating the half edge mesh.
Definition EBGeometry_DCEL_Iterator.hpp:51
Half-edge class for navigating a DCEL mesh.
Definition EBGeometry_DCEL_Edge.hpp:60
Face class for navigating a DCEL mesh.
Definition EBGeometry_DCEL_Face.hpp:68
Vec3T< T > & getNormal() noexcept
Get modifiable normal vector.
uint32_t numVertices(const Mesh &a_mesh) const noexcept
Number of vertices on this face's half-edge loop.
bool isPointInsideFace(const Vec3 &a_p, const Mesh &a_mesh) const noexcept
Check if a point projects to inside or outside the polygon face.
void normalizeNormalVector() noexcept
Normalize the normal vector, ensuring it has a length of 1.
T signedDistance(const Vec3 &a_x0, const Mesh &a_mesh) const noexcept
Compute the signed distance to a point.
Vec3T< T > getHighestCoordinate(const Mesh &a_mesh) const noexcept
Get the upper-right-most coordinate of this polygon face.
void setHalfEdge(const uint32_t a_halfEdgeIndex) noexcept
Set the half edge index.
FaceT(const Face &a_otherFace)=default
Copy constructor.
Vec3T< T > getSmallestCoordinate(const Mesh &a_mesh) const noexcept
Get the lower-left-most coordinate of this polygon face.
FaceT()=default
Default constructor. Sets the half-edge index to the unset sentinel and the inside/outside algorithm ...
std::vector< uint32_t > gatherVertexIndices(const Mesh &a_mesh) const
Return the indices of all the vertices on this polygon.
FaceT(Face &&a_otherFace)=default
Move constructor.
std::vector< uint32_t > gatherEdgeIndices(const Mesh &a_mesh) const
Return the indices of all the half-edges on this polygon.
T & getArea() noexcept
Get modifiable polygon area (computed during reconcile()).
void computeProjectionDirections() noexcept
Compute the 2D embedding of this polygon from the current normal vector and topology,...
Vec3 m_normal
Polygon face normal vector.
Definition EBGeometry_DCEL_Face.hpp:412
T unsignedDistance2(const Vec3 &a_x0, const Mesh &a_mesh) const noexcept
Compute the unsigned squared distance to a point.
void define(const Vec3 &a_normal, const uint32_t a_edgeIndex) noexcept
Define function which sets the normal vector and half-edge index.
void computeNormal(const Mesh &a_mesh)
Compute the unit normal vector of this polygon (Newell's method).
Vec2T< T > projectPoint(const Vec3 &a_point) const noexcept
Project a 3D point to this face's 2D embedding by dropping one coordinate.
FaceT(const uint32_t a_edgeIndex)
Partial constructor. Calls default constructor but associates a half-edge.
~FaceT()=default
Destructor (does nothing)
size_t computeCrossingNumber(const Vec2T< T > &a_point, const Mesh &a_mesh) const noexcept
Compute the crossing number of a +x ray from a projected 2D point with this polygon.
T rayCrossing(const Vec3 &a_origin, const Vec3 &a_direction, T a_tMin, T a_tMax, const Mesh &a_mesh) const noexcept
Where a ray crosses the face, from either side.
void computeCentroid(const Mesh &a_mesh)
Compute the centroid position of this polygon.
uint32_t m_yDir
Cartesian axis used as the 2D y-direction of this polygon's 2D embedding (stored by reconcile()).
Definition EBGeometry_DCEL_Face.hpp:439
InsideOutsideAlgorithm m_insideOutsideAlgorithm
Algorithm for inside/outside tests.
Definition EBGeometry_DCEL_Face.hpp:444
void setInsideOutsideAlgorithm(InsideOutsideAlgorithm a_algorithm) noexcept
Set the inside/outside algorithm when determining if a point projects to the inside or outside of the...
void flipNormal() noexcept
Flip the normal vector.
T computeSubtendedAngle(const Vec2T< T > &a_point, const Mesh &a_mesh) const noexcept
Compute the total subtended angle of this polygon's edges around a projected 2D point.
uint32_t m_halfEdge
This polygon's half-edge index. A valid face will always have this set.
Definition EBGeometry_DCEL_Face.hpp:407
Vec3T< T > & getCentroid() noexcept
Get modifiable centroid.
void computeArea(const Mesh &a_mesh)
Compute the area of this polygon and cache it in m_area.
Vec3 m_centroid
Polygon face centroid position.
Definition EBGeometry_DCEL_Face.hpp:417
uint32_t getHalfEdgeIndex() const noexcept
Get the index of the starting half-edge.
Vec3T< T > projectPointIntoFacePlane(const Vec3 &a_p) const noexcept
Compute the projection of a point onto the polygon face plane.
void reconcile(const Mesh &a_mesh)
Reconcile face. This will compute the normal vector, area, centroid, and the 2D embedding of the poly...
uint32_t m_xDir
Cartesian axis used as the 2D x-direction of this polygon's 2D embedding (stored by reconcile())....
Definition EBGeometry_DCEL_Face.hpp:432
std::vector< Vec3T< T > > getAllVertexCoordinates(const Mesh &a_mesh) const
Return the coordinates of all the vertices on this polygon.
T m_area
Cached polygon face area (stored by reconcile()).
Definition EBGeometry_DCEL_Face.hpp:422
int computeWindingNumber(const Vec2T< T > &a_point, const Mesh &a_mesh) const noexcept
Compute the winding number of this polygon's boundary around a projected 2D point.
Face & operator=(Face &&a_otherFace)=default
Move assignment operator.
Face & operator=(const Face &a_otherFace)=default
Copy assignment operator.
DCEL mesh class - stores a doubly-connected edge mesh.
Definition EBGeometry_DCEL_Mesh.hpp:102
Vertex class for navigating a DCEL mesh.
Definition EBGeometry_DCEL_Vertex.hpp:63
Two-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:37
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
InsideOutsideAlgorithm
Supported algorithms for testing whether a point projects to the inside of a polygon face.
Definition EBGeometry_DCEL.hpp:67
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26