EBGeometry 1.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
EBGeometry::Triangle2D< T > Class Template Reference

Class for embedding a triangle face into 2D. More...

#include <EBGeometry_Triangle2D.hpp>

Public Types

enum class  InsideOutsideAlgorithm { SubtendedAngle , CrossingNumber , WindingNumber }
 Supported algorithms for performing inside/outside tests when checking if a point projects to the inside or outside of a polygon face.
 
using Vec2 = Vec2T< T >
 Alias for 2D vector type.
 
using Vec3 = Vec3T< T >
 Alias for 3D vector type.
 

Public Member Functions

 Triangle2D () noexcept=default
 Default constructor. Must subsequently call the define function.
 
 Triangle2D (const Vec3 &a_normal, const std::array< Vec3, 3 > &a_vertices) noexcept
 Full constructor.
 
 Triangle2D (const Triangle2D &a_triangle2D) noexcept=default
 Copy constructor.
 
 Triangle2D (Triangle2D &&a_triangle2D) noexcept=default
 Move constructor.
 
 ~Triangle2D () noexcept=default
 Destructor (does nothing)
 
Triangle2Doperator= (const Triangle2D &a_triangle2D) noexcept=default
 Copy assignment.
 
Triangle2Doperator= (Triangle2D &&a_triangle2D) noexcept=default
 Move assignment.
 
void define (const Vec3 &a_normal, const std::array< Vec3, 3 > &a_vertices) noexcept
 Define function. Puts object in usable state.
 
bool isPointInside (const Vec3 &a_point, InsideOutsideAlgorithm a_algorithm) const noexcept
 Check if a point is inside or outside the 2D polygon.
 
bool isPointInsideWindingNumber (const Vec3 &a_point) const noexcept
 Check if a point is inside a 2D polygon, using the winding number algorithm.
 
bool isPointInsideCrossingNumber (const Vec3 &a_point) const noexcept
 Check if a point is inside a 2D polygon, by computing the number of times a ray crosses the polygon edges.
 
bool isPointInsideSubtend (const Vec3 &a_point) const noexcept
 Check if a point is inside a 2D polygon, using the subtended angles.
 

Detailed Description

template<class T>
class EBGeometry::Triangle2D< T >

Class for embedding a triangle face into 2D.

This class is required for determining whether or not a 3D point projected to the plane of a triangle lies inside or outside the triangle. To do this we compute the 2D embedding of the triangle face, reducing the problem to a tractable dimension where we can use well-tested algorithm. Once the 2D embedding is computed, we can use well-known algorithms for checking if a point lies inside or outside. The supported algorithms are 1) The winding number algorithm (computing the winding number), 2) Computing the subtended angle of the point with the edges of the polygon (sums to 360 degrees if the point is inside), or computing the crossing number which checks how many times a ray cast from the point crosses the edges of the triangle.

Constructor & Destructor Documentation

◆ Triangle2D() [1/3]

template<class T >
EBGeometry::Triangle2D< T >::Triangle2D ( const Vec3 a_normal,
const std::array< Vec3, 3 > &  a_vertices 
)
noexcept

Full constructor.

Parameters
[in]a_normalNormal vector of the 3D triangle
[in]a_verticesVertex coordinates of the 3D triangle

◆ Triangle2D() [2/3]

template<class T >
EBGeometry::Triangle2D< T >::Triangle2D ( const Triangle2D< T > &  a_triangle2D)
defaultnoexcept

Copy constructor.

Parameters
[in]a_triangle2DOther triangle

◆ Triangle2D() [3/3]

template<class T >
EBGeometry::Triangle2D< T >::Triangle2D ( Triangle2D< T > &&  a_triangle2D)
defaultnoexcept

Move constructor.

Parameters
[in,out]a_triangle2DOther triangle

Member Function Documentation

◆ define()

template<class T >
void EBGeometry::Triangle2D< T >::define ( const Vec3 a_normal,
const std::array< Vec3, 3 > &  a_vertices 
)
noexcept

Define function. Puts object in usable state.

Parameters
[in]a_normalNormal vector of the 3D triangle
[in]a_verticesVertex coordinates of the 3D triangle

◆ isPointInside()

template<class T >
bool EBGeometry::Triangle2D< T >::isPointInside ( const Vec3 a_point,
InsideOutsideAlgorithm  a_algorithm 
) const
noexcept

Check if a point is inside or outside the 2D polygon.

Parameters
[in]a_point3D point coordinates
[in]a_algorithmInside/outside algorithm

This will call the function corresponding to a_algorithm.

◆ isPointInsideCrossingNumber()

template<class T >
bool EBGeometry::Triangle2D< T >::isPointInsideCrossingNumber ( const Vec3 a_point) const
noexcept

Check if a point is inside a 2D polygon, by computing the number of times a ray crosses the polygon edges.

Parameters
[in]a_point3D point coordinates
Returns
Returns true if the 3D point projects to the inside of the 2D polygon

◆ isPointInsideSubtend()

template<class T >
bool EBGeometry::Triangle2D< T >::isPointInsideSubtend ( const Vec3 a_point) const
noexcept

Check if a point is inside a 2D polygon, using the subtended angles.

Parameters
[in]a_point3D point coordinates
Returns
Returns true if the 3D point projects to the inside of the 2D polygon

◆ isPointInsideWindingNumber()

template<class T >
bool EBGeometry::Triangle2D< T >::isPointInsideWindingNumber ( const Vec3 a_point) const
noexcept

Check if a point is inside a 2D polygon, using the winding number algorithm.

Parameters
[in]a_point3D point coordinates
Returns
Returns true if the 3D point projects to the inside of the 2D polygon

◆ operator=() [1/2]

template<class T >
Triangle2D & EBGeometry::Triangle2D< T >::operator= ( const Triangle2D< T > &  a_triangle2D)
defaultnoexcept

Copy assignment.

Parameters
[in]a_triangle2DOther triangle

◆ operator=() [2/2]

template<class T >
Triangle2D & EBGeometry::Triangle2D< T >::operator= ( Triangle2D< T > &&  a_triangle2D)
defaultnoexcept

Move assignment.

Parameters
[in,out]a_triangle2DOther triangle

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