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.5.0/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 | |
AXOM_HOST_DEVICE | Triangle () |
Default constructor. Creates a degenerate triangle. More... | |
AXOM_HOST_DEVICE | Triangle (const PointType &A, const PointType &B, const PointType &C) |
Custom Constructor. Creates a triangle from the 3 points A,B,C. More... | |
AXOM_HOST_DEVICE | ~Triangle () |
Destructor. More... | |
AXOM_HOST_DEVICE PointType & | operator[] (int idx) |
Index operator to get the i^th vertex. More... | |
AXOM_HOST_DEVICE const PointType & | operator[] (int idx) const |
Index operator to get the i^th vertex. More... | |
AXOM_HOST_DEVICE VectorType | normal () const |
Returns the normal of the triangle (not normalized) More... | |
AXOM_HOST_DEVICE 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... | |
AXOM_HOST_DEVICE 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 |
axom::primal::Triangle< T, NDIMS >::Triangle | ( | ) |
Default constructor. Creates a degenerate triangle.
axom::primal::Triangle< T, NDIMS >::Triangle | ( | const PointType & | A, |
const PointType & | B, | ||
const PointType & | C | ||
) |
|
inline |
Destructor.
References AXOM_HOST_DEVICE.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References AXOM_HOST_DEVICE, 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_HOST_DEVICE, axom::primal::Triangle< T, NDIMS >::NUM_TRI_VERTS, and SLIC_ASSERT.
|
inline |
Returns the normal of the triangle (not normalized)
References AXOM_HOST_DEVICE, axom::primal::Vector< T, NDIMS >::cross_product(), and SLIC_CHECK_MSG.
|
inline |
Returns the area of the triangle.
References A, B, C, 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 A, axom::utilities::abs(), B, C, 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_HOST_DEVICE, 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().
Referenced by axom::quest::getMeshTriangle().
|
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 |