EBGeometry  1.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DCEL::FaceT< T, Meta > Class Template Reference

Face class. More...

#include <EBGeometry_DCEL_Face.hpp>

Public Types

using Vec3 = Vec3T< T >
 Alias for vector type.
 
using Vertex = VertexT< T, Meta >
 Alias for vertex type.
 
using Edge = EdgeT< T, Meta >
 Alias for edge type.
 
using Face = FaceT< T, Meta >
 Alias for face type.
 
using VertexPtr = std::shared_ptr< Vertex >
 Alias for vertex pointer type.
 
using EdgePtr = std::shared_ptr< Edge >
 Alias for edge pointer type.
 
using FacePtr = std::shared_ptr< Face >
 Alias for face pointer type.
 
using EdgeIterator = EdgeIteratorT< T, Meta >
 Alias for edge iterator.
 

Public Member Functions

 FaceT ()
 Default constructor. Sets the half-edge to zero and the inside/outside algorithm to crossing number algorithm.
 
 FaceT (const EdgePtr &a_edge)
 Partial constructor. Calls default constructor but associates a half-edge. More...
 
 FaceT (const Face &a_otherFace)
 Partial constructor. More...
 
virtual ~FaceT ()
 Destructor (does nothing)
 
void define (const Vec3 &a_normal, const EdgePtr &a_edge) noexcept
 Define function which sets the normal vector and half-edge. More...
 
void reconcile () noexcept
 Reconcile face. This will compute the normal vector, area, centroid, and the 2D embedding of the polygon. More...
 
void flip () noexcept
 Flip the normal vector.
 
void setHalfEdge (const EdgePtr &a_halfEdge) noexcept
 Set the half edge. More...
 
void setInsideOutsideAlgorithm (typename Polygon2D< T >::InsideOutsideAlgorithm &a_algorithm) noexcept
 Set the inside/outside algorithm when determining if a point projects to the inside or outside of the polygon. More...
 
EdgePtrgetHalfEdge () noexcept
 Get modifiable half-edge.
 
const EdgePtrgetHalfEdge () const noexcept
 Get immutable half-edge.
 
Vec3T< T > & getCentroid () noexcept
 Get modifiable centroid.
 
const Vec3T< T > & getCentroid () const noexcept
 Get immutable centroid.
 
T & getCentroid (const size_t a_dir) noexcept
 Get modifiable centroid position in specified coordinate direction. More...
 
const T & getCentroid (const size_t a_dir) const noexcept
 Get immutable centroid position in specified coordinate direction. More...
 
Vec3T< T > & getNormal () noexcept
 Get modifiable normal vector.
 
const Vec3T< T > & getNormal () const noexcept
 Get immutable normal vector.
 
Meta & getMetaData () noexcept
 Get meta-data. More...
 
const Meta & getMetaData () const noexcept
 Get meta-data. More...
 
computeArea () noexcept
 Compute the area of this polygon.
 
signedDistance (const Vec3 &a_x0) const noexcept
 Compute the signed distance to a point. More...
 
unsignedDistance2 (const Vec3 &a_x0) const noexcept
 Compute the unsigned squared distance to a point. More...
 
std::vector< Vec3T< T > > getAllVertexCoordinates () const noexcept
 Return the coordinates of all the vertices on this polygon. More...
 
std::vector< VertexPtrgatherVertices () const noexcept
 Return all the vertices on this polygon. More...
 
Vec3T< T > getSmallestCoordinate () const noexcept
 Get the lower-left-most coordinate of this polygon face.
 
Vec3T< T > getHighestCoordinate () const noexcept
 Get the upper-right-most coordinate of this polygon face.
 

Protected Member Functions

void computeCentroid () noexcept
 Compute the centroid position of this polygon.
 
void computeNormal () noexcept
 Compute the normal position of this polygon.
 
void computePolygon2D () noexcept
 Compute the 2D embedding of this polygon.
 
void normalizeNormalVector () noexcept
 Normalize the normal vector, ensuring it has a length of 1.
 
getArea () noexcept
 Get the area of this polygon face.
 
getArea () const noexcept
 Get the area of this polygon face.
 
void computeAndStoreEdges () noexcept
 Compute and store all the half-edges around this polygon face.
 
Vec3T< T > projectPointIntoFacePlane (const Vec3 &a_p) const noexcept
 Compute the projection of a point onto the polygon face plane. More...
 
bool isPointInsideFace (const Vec3 &a_p) const noexcept
 Check if a point projects to inside or outside the polygon face. More...
 

Protected Attributes

EdgePtr m_halfEdge
 This polygon's half-edge. A valid face will always have != nullptr.
 
Vec3 m_normal
 Polygon face normal vector.
 
Vec3 m_centroid
 Polygon face centroid position.
 
Meta m_metaData
 Meta-data attached to this face.
 
std::shared_ptr< Polygon2D< T > > m_poly2
 2D embedding of this polygon. This is the 2D view of the current object projected along its normal vector cardinal.
 
Polygon2D< T >::InsideOutsideAlgorithm m_poly2Algorithm
 Algorithm for inside/outside tests.
 

Detailed Description

template<class T, class Meta>
class DCEL::FaceT< T, Meta >

Face class.

Class which represents a polygon face in a double-edge connected list (DCEL).

This class is a polygon face in a DCEL mesh. It contains pointer storage to one of the half-edges that circulate the inside of the polygon face, as well as having a normal vector, a centroid, and an area. This class supports signed distance computations. These computations require algorithms that compute e.g. the winding number of the polygon, or the number of times a ray cast passes through it. Thus, one of its central features is that it can be embedded in 2D by projecting it along the cardinal direction of its normal vector. To be fully consistent with a DCEL structure the class stores a reference to one of its half edges, but for performance reasons it also stores references to the other half edges.

Note
To compute the distance from a point to the face one must determine if the point projects "inside" or "outside" the polygon. There are several algorithms for this, and by default this class uses a crossing number algorithm.

Constructor & Destructor Documentation

◆ FaceT() [1/2]

template<class T , class Meta >
DCEL::FaceT< T, Meta >::FaceT ( const EdgePtr a_edge)

Partial constructor. Calls default constructor but associates a half-edge.

Parameters
[in]a_edgeHalf-edge

◆ FaceT() [2/2]

template<class T , class Meta >
DCEL::FaceT< T, Meta >::FaceT ( const Face a_otherFace)

Partial constructor.

Calls default constructor but sets the normal vector and half-edge equal to the other face's (rest is undefined)

Member Function Documentation

◆ define()

template<class T , class Meta >
void DCEL::FaceT< T, Meta >::define ( const Vec3 a_normal,
const EdgePtr a_edge 
)
inlinenoexcept

Define function which sets the normal vector and half-edge.

Parameters
[in]a_normalNormal vector
[in]a_edgeHalf edge

◆ gatherVertices()

template<class T , class Meta >
std::vector<VertexPtr> DCEL::FaceT< T, Meta >::gatherVertices ( ) const
inlinenoexcept

Return all the vertices on this polygon.

This builds a list of all the vertices and returns it.

◆ getAllVertexCoordinates()

template<class T , class Meta >
std::vector<Vec3T<T> > DCEL::FaceT< T, Meta >::getAllVertexCoordinates ( ) const
inlinenoexcept

Return the coordinates of all the vertices on this polygon.

This builds a list of all the vertex coordinates and returns it.

◆ getCentroid() [1/2]

template<class T , class Meta >
const T& DCEL::FaceT< T, Meta >::getCentroid ( const size_t  a_dir) const
inlinenoexcept

Get immutable centroid position in specified coordinate direction.

Parameters
[in]a_dirCoordinate direction

◆ getCentroid() [2/2]

template<class T , class Meta >
T& DCEL::FaceT< T, Meta >::getCentroid ( const size_t  a_dir)
inlinenoexcept

Get modifiable centroid position in specified coordinate direction.

Parameters
[in]a_dirCoordinate direction

◆ getMetaData() [1/2]

template<class T , class Meta >
const Meta& DCEL::FaceT< T, Meta >::getMetaData ( ) const
inlinenoexcept

Get meta-data.

Returns
m_metaData

◆ getMetaData() [2/2]

template<class T , class Meta >
Meta& DCEL::FaceT< T, Meta >::getMetaData ( )
inlinenoexcept

Get meta-data.

Returns
m_metaData

◆ isPointInsideFace()

template<class T , class Meta >
bool DCEL::FaceT< T, Meta >::isPointInsideFace ( const Vec3 a_p) const
inlineprotectednoexcept

Check if a point projects to inside or outside the polygon face.

Parameters
[in]a_pPoint in space
Returns
Returns true if a_p projects to inside the polygon and false otherwise.

◆ projectPointIntoFacePlane()

template<class T , class Meta >
Vec3T<T> DCEL::FaceT< T, Meta >::projectPointIntoFacePlane ( const Vec3 a_p) const
inlineprotectednoexcept

Compute the projection of a point onto the polygon face plane.

Parameters
[in]a_pPoint in space

◆ reconcile()

template<class T , class Meta >
void DCEL::FaceT< T, Meta >::reconcile ( )
inlinenoexcept

Reconcile face. This will compute the normal vector, area, centroid, and the 2D embedding of the polygon.

Note
"Everything" must be set before doing this, i.e. the face must be complete with half edges and there can be no dangling edges.

◆ setHalfEdge()

template<class T , class Meta >
void DCEL::FaceT< T, Meta >::setHalfEdge ( const EdgePtr a_halfEdge)
inlinenoexcept

Set the half edge.

Parameters
[in]a_halfEdgeHalf edge

◆ setInsideOutsideAlgorithm()

template<class T , class Meta >
void DCEL::FaceT< T, Meta >::setInsideOutsideAlgorithm ( typename Polygon2D< T >::InsideOutsideAlgorithm &  a_algorithm)
inlinenoexcept

Set the inside/outside algorithm when determining if a point projects to the inside or outside of the polygon.

Parameters
[in]a_algorithmDesired algorithm
Note
See CD_DCELAlgorithms.H for options (and CD_DCELPolyImplem.H for how the algorithms operate).

◆ signedDistance()

template<class T , class Meta >
T DCEL::FaceT< T, Meta >::signedDistance ( const Vec3 a_x0) const
inlinenoexcept

Compute the signed distance to a point.

Parameters
[in]a_x0Point in space

This algorithm operates by checking if the input point projects to the inside of the polygon. If it does then the distance is just the projected distance onto the polygon plane and the sign is well-defined. Otherwise, we check the distance to the edges of the polygon.

◆ unsignedDistance2()

template<class T , class Meta >
T DCEL::FaceT< T, Meta >::unsignedDistance2 ( const Vec3 a_x0) const
inlinenoexcept

Compute the unsigned squared distance to a point.

Parameters
[in]a_x0Point in space

This algorithm operates by checking if the input point projects to the inside of the polygon. If it does then the distance is just the projected distance onto the polygon plane. Otherwise, we check the distance to the edges of the polygon.


The documentation for this class was generated from the following files: