AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Represents a triangular geometric shape defined by three points. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.3.3/src/axom/primal/geometry/Triangle.hpp>
Public Types | |
enum | { NUM_TRI_VERTS = 3 } |
typedef Point< T, NDIMS > | PointType |
typedef Vector< T, NDIMS > | VectorType |
Public Member Functions | |
Triangle () | |
Default constructor. Creates a degenerate triangle. More... | |
Triangle (const PointType &A, const PointType &B, const PointType &C) | |
Custom Constructor. Creates a triangle from the 3 points A,B,C. More... | |
~Triangle () | |
Destructor. More... | |
PointType & | operator[] (int idx) |
Index operator to get the i^th vertex. More... | |
const PointType & | operator[] (int idx) const |
Index operator to get the i^th vertex. More... | |
VectorType | normal () const |
Returns the normal of the triangle (not normalized) More... | |
double | area () const |
Returns the area of the triangle. More... | |
Point< double, 3 > | physToBarycentric (const PointType &p) const |
Returns the barycentric coordinates of a point within a triangle. More... | |
PointType | baryToPhysical (const Point< double, 3 > &bary) const |
Returns the physical coordinates of a barycentric point. More... | |
bool | degenerate (double eps=1.0e-12) const |
Returns whether the triangle is degenerate. More... | |
bool | checkInTriangle (const PointType &p, double eps=1.0e-8) const |
Returns whether Point P is in the triangle for some 3d Triangle. More... | |
double | angle (int idx) const |
Computes the request angle corresponding to the given vertex ID. More... | |
std::ostream & | print (std::ostream &os) const |
Simple formatted print of a triangle instance. More... | |
Represents a triangular geometric shape defined by three points.
T | the coordinate type, e.g., double, float, etc. |
NDIMS | the number of dimensions |
typedef Point< T,NDIMS > axom::primal::Triangle< T, NDIMS >::PointType |
typedef Vector< T,NDIMS > axom::primal::Triangle< T, NDIMS >::VectorType |
|
inline |
axom::primal::Triangle< T, NDIMS >::Triangle | ( | const PointType & | A, |
const PointType & | B, | ||
const PointType & | C | ||
) |
|
inline |
Destructor.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References axom::primal::Triangle< T, NDIMS >::NUM_TRI_VERTS, and SLIC_ASSERT.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References axom::primal::Triangle< T, NDIMS >::NUM_TRI_VERTS, and SLIC_ASSERT.
|
inline |
Returns the normal of the triangle (not normalized)
References axom::primal::Vector< T, NDIMS >::cross_product(), and SLIC_CHECK_MSG.
|
inline |
Returns the area of the triangle.
References axom::primal::Vector< T, NDIMS >::cross_product(), and SLIC_CHECK_MSG.
Referenced by axom::primal::Triangle< T, NDIMS >::degenerate().
|
inline |
Returns the barycentric coordinates of a point within a triangle.
References axom::utilities::abs(), axom::primal::Vector< T, NDIMS >::cross_product(), axom::numerics::determinant(), axom::utilities::isNearlyEqual(), and SLIC_CHECK.
Referenced by axom::primal::Triangle< T, NDIMS >::checkInTriangle().
|
inline |
Returns the physical coordinates of a barycentric point.
[in] | bary | Barycentric coordinates relative to this triangle |
References axom::utilities::isNearlyEqual(), and SLIC_CHECK_MSG.
|
inline |
Returns whether the triangle is degenerate.
References axom::primal::Triangle< T, NDIMS >::area(), and axom::utilities::isNearlyEqual().
|
inline |
Returns whether Point P is in the triangle for some 3d Triangle.
References axom::primal::Triangle< T, NDIMS >::angle(), axom::utilities::isNearlyEqual(), and axom::primal::Triangle< T, NDIMS >::physToBarycentric().
|
inline |
Computes the request angle corresponding to the given vertex ID.
[in] | idx | the index of the corresponding vertex |
References axom::primal::Vector< T, NDIMS >::dot_product(), axom::primal::Vector< T, NDIMS >::norm(), axom::primal::Triangle< T, NDIMS >::NUM_TRI_VERTS, and SLIC_ASSERT.
Referenced by axom::primal::Triangle< T, NDIMS >::checkInTriangle().
|
inline |
Simple formatted print of a triangle instance.
os | The output stream to write to |