EBGeometry 1.0
|
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) | |
Triangle2D & | operator= (const Triangle2D &a_triangle2D) noexcept=default |
Copy assignment. | |
Triangle2D & | operator= (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. | |
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.
|
noexcept |
Full constructor.
[in] | a_normal | Normal vector of the 3D triangle |
[in] | a_vertices | Vertex coordinates of the 3D triangle |
|
defaultnoexcept |
Copy constructor.
[in] | a_triangle2D | Other triangle |
|
defaultnoexcept |
Move constructor.
[in,out] | a_triangle2D | Other triangle |
|
noexcept |
Define function. Puts object in usable state.
[in] | a_normal | Normal vector of the 3D triangle |
[in] | a_vertices | Vertex coordinates of the 3D triangle |
|
noexcept |
Check if a point is inside or outside the 2D polygon.
[in] | a_point | 3D point coordinates |
[in] | a_algorithm | Inside/outside algorithm |
This will call the function corresponding to a_algorithm.
|
noexcept |
Check if a point is inside a 2D polygon, by computing the number of times a ray crosses the polygon edges.
[in] | a_point | 3D point coordinates |
|
noexcept |
Check if a point is inside a 2D polygon, using the subtended angles.
[in] | a_point | 3D point coordinates |
|
noexcept |
Check if a point is inside a 2D polygon, using the winding number algorithm.
[in] | a_point | 3D point coordinates |
|
defaultnoexcept |
Copy assignment.
[in] | a_triangle2D | Other triangle |
|
defaultnoexcept |
Move assignment.
[in,out] | a_triangle2D | Other triangle |