AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Represents a tetrahedral geometric shape defined by four points. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/main/src/axom/primal/geometry/Tetrahedron.hpp>
Public Types | |
using | PointType = Point< T, NDIMS > |
using | VectorType = Vector< T, NDIMS > |
using | SphereType = Sphere< T, NDIMS > |
Public Member Functions | |
AXOM_HOST_DEVICE | Tetrahedron () |
Default constructor. Creates a degenerate tetrahedron. More... | |
AXOM_HOST_DEVICE | Tetrahedron (const PointType &A, const PointType &B, const PointType &C, const PointType &D) |
Tetrahedron constructor from 4 points A,B,C,D. More... | |
AXOM_HOST_DEVICE | Tetrahedron (const PointType *pts) |
Tetrahedron constructor from an array of Points. More... | |
AXOM_HOST_DEVICE | Tetrahedron (const axom::ArrayView< PointType > pts) |
Tetrahedron constructor from an Array of Points. More... | |
AXOM_HOST_DEVICE | Tetrahedron (std::initializer_list< PointType > pts) |
Tetrahedron constructor from an initializer list of Points. 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 bool | degenerate (double eps=1.0e-12) const |
Returns whether the tetrahedron is degenerate. More... | |
Point< double, 4 > | physToBarycentric (const PointType &p, bool skipNormalization=false) const |
Returns the barycentric coordinates of a point within a tetrahedron. More... | |
PointType | baryToPhysical (const Point< double, 4 > &bary) const |
Returns the physical coordinates of a barycentric point. More... | |
std::ostream & | print (std::ostream &os) const |
Simple formatted print of a tetrahedron instance. More... | |
AXOM_HOST_DEVICE double | signedVolume () const |
Returns the signed volume of the tetrahedron. More... | |
AXOM_HOST_DEVICE double | volume () const |
Returns the absolute (unsigned) volume of the tetrahedron. More... | |
AXOM_HOST_DEVICE void | checkAndFixOrientation () |
Swaps the order of vertices if the signed volume of the tetrahedron is negative. Signed volume will become positive. More... | |
template<int TDIM = NDIMS> | |
std::enable_if< TDIM==3, SphereType >::type | circumsphere () const |
Returns the circumsphere (circumscribing sphere) of the tetrahedron. More... | |
Static Public Attributes | |
static constexpr int | NUM_VERTS = 4 |
Represents a tetrahedral geometric shape defined by four points.
T | the coordinate type, e.g., double, float, etc. |
NDIMS | the number of spatial dimensions |
using axom::primal::Tetrahedron< T, NDIMS >::PointType = Point<T, NDIMS> |
using axom::primal::Tetrahedron< T, NDIMS >::VectorType = Vector<T, NDIMS> |
using axom::primal::Tetrahedron< T, NDIMS >::SphereType = Sphere<T, NDIMS> |
|
inline |
Default constructor. Creates a degenerate tetrahedron.
|
inline |
Tetrahedron constructor from 4 points A,B,C,D.
[in] | A | Vertex A of the tetrahedron |
[in] | B | Vertex B of the tetrahedron |
[in] | C | Vertex C of the tetrahedron |
[in] | D | Vertex D of the tetrahedron |
|
inlineexplicit |
Tetrahedron constructor from an array of Points.
[in] | pts | An array containing at least 4 Points. |
References axom::primal::Tetrahedron< T, NDIMS >::NUM_VERTS.
|
inlineexplicit |
Tetrahedron constructor from an Array of Points.
[in] | pts | An ArrayView containing 4 Points. |
References axom::primal::Tetrahedron< T, NDIMS >::NUM_VERTS, axom::ArrayView< T, DIM, SPACE >::size(), and SLIC_ASSERT.
|
inlineexplicit |
Tetrahedron constructor from an initializer list of Points.
[in] | pts | an initializer list containing 4 Points |
References axom::primal::Tetrahedron< T, NDIMS >::NUM_VERTS, and SLIC_ASSERT.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References axom::primal::Tetrahedron< T, NDIMS >::NUM_VERTS, and SLIC_ASSERT.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References axom::primal::Tetrahedron< T, NDIMS >::NUM_VERTS, and SLIC_ASSERT.
|
inline |
Returns whether the tetrahedron is degenerate.
References axom::utilities::isNearlyEqual().
|
inline |
Returns the barycentric coordinates of a point within a tetrahedron.
[in] | p | The point at which we want to compute barycentric coordinates |
[in] | skipNormalization | Determines if the result should be normalized by the volume of the tetrahedron. One might want to skip this if they were only interested in the relative weights rather than their actual amounts |
References axom::primal::abs(), axom::primal::Point< T, NDIMS >::array(), axom::primal::Vector< T, NDIMS >::scalar_triple_product(), and axom::primal::NumericArray< T, SIZE >::sum().
|
inline |
Returns the physical coordinates of a barycentric point.
[in] | bary | Barycentric coordinates relative to this tetrahedron |
References axom::primal::Point< T, NDIMS >::array(), axom::utilities::isNearlyEqual(), axom::primal::Tetrahedron< T, NDIMS >::NUM_VERTS, and SLIC_CHECK_MSG.
|
inline |
Simple formatted print of a tetrahedron instance.
os | The output stream to write to |
|
inline |
Returns the signed volume of the tetrahedron.
|
inline |
Returns the absolute (unsigned) volume of the tetrahedron.
References axom::utilities::abs(), and axom::primal::Tetrahedron< T, NDIMS >::signedVolume().
|
inline |
Swaps the order of vertices if the signed volume of the tetrahedron is negative. Signed volume will become positive.
References axom::primal::Tetrahedron< T, NDIMS >::signedVolume().
|
inline |
Returns the circumsphere (circumscribing sphere) of the tetrahedron.
Derived from formula on https://mathworld.wolfram.com/Circumsphere.html but uses observation that radius can be derived from distance to a vertex
References axom::primal::Vector< T, NDIMS >::scalar_triple_product().
|
staticconstexpr |