AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Represents a quadrilateral geometric shape defined by four points. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/primal/geometry/Quadrilateral.hpp>
Public Types | |
using | PointType = Point< T, NDIMS > |
using | TriangleType = Triangle< T, NDIMS > |
Public Member Functions | |
Quadrilateral ()=default | |
Default constructor. Creates a degenerate quadrilateral. More... | |
AXOM_HOST_DEVICE | Quadrilateral (const PointType &A, const PointType &B, const PointType &C, const PointType &D) |
Custom Constructor. Creates a quadrilateral from the 4 points A, B, C, and D. More... | |
AXOM_HOST_DEVICE | Quadrilateral (std::initializer_list< PointType > pts) |
Quadrilateral constructor from an initializer list of Points. More... | |
AXOM_HOST_DEVICE | Quadrilateral (const axom::ArrayView< PointType > pts) |
Quadrilateral constructor from an Array 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... | |
template<int TDIM = NDIMS> | |
AXOM_HOST_DEVICE std::enable_if< TDIM==2, double >::type | area () const |
Returns the area of the quadrilateral (2D specialization) More... | |
template<int TDIM = NDIMS> | |
AXOM_HOST_DEVICE std::enable_if< TDIM==2, double >::type | signedArea () const |
Returns the signed area of a 2D quadrilateral. More... | |
AXOM_HOST_DEVICE double | volume () const |
Returns the volume of the quadrilateral (synonym for area()) More... | |
template<int TDIM = NDIMS> | |
AXOM_HOST_DEVICE std::enable_if< TDIM==2, double >::type | signedVolume () const |
Returns the signed volume of a 2D quadrilateral (synonym for signedArea()) More... | |
std::ostream & | print (std::ostream &os) const |
Simple formatted print of a quadrilateral instance. More... | |
Static Public Attributes | |
static constexpr int | DIM = NDIMS |
static constexpr int | NUM_QUAD_VERTS = 4 |
Represents a quadrilateral geometric shape defined by four points.
T | the coordinate type, e.g., double, float, etc. |
NDIMS | the number of dimensions |
There are four vertices in the quadrilateral, labeled A through D as the constructor's arguments. They are accessible using the square-brackets operator, with A being index 0, B index 1, C index 2, and D index 3.
Here's a diagram showing a square with the labeled vertices.
* * D +---------+ C +y * | | * | | ^ * | | | * | | | * A +---------+ B -----> +x * *
using axom::primal::Quadrilateral< T, NDIMS >::PointType = Point<T, NDIMS> |
using axom::primal::Quadrilateral< T, NDIMS >::TriangleType = Triangle<T, NDIMS> |
|
default |
Default constructor. Creates a degenerate quadrilateral.
|
inline |
Custom Constructor. Creates a quadrilateral from the 4 points A, B, C, and D.
[in] | A | point corresponding to vertex A of the quadrilateral. |
[in] | B | point corresponding to vertex B of the quadrilateral. |
[in] | C | point corresponding to vertex C of the quadrilateral. |
[in] | D | point corresponding to vertex D of the quadrilateral. |
|
inlineexplicit |
Quadrilateral constructor from an initializer list of Points.
[in] | pts | an initializer list containing 4 Points |
References axom::primal::Quadrilateral< T, NDIMS >::NUM_QUAD_VERTS, and SLIC_ASSERT.
|
inlineexplicit |
Quadrilateral constructor from an Array of Points.
[in] | pts | An ArrayView containing 4 Points. |
References axom::primal::Quadrilateral< T, NDIMS >::NUM_QUAD_VERTS, axom::ArrayView< T, DIM, SPACE >::size(), and SLIC_ASSERT.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References axom::primal::Quadrilateral< T, NDIMS >::NUM_QUAD_VERTS, and SLIC_ASSERT.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References axom::primal::Quadrilateral< T, NDIMS >::NUM_QUAD_VERTS, and SLIC_ASSERT.
|
inline |
Returns the area of the quadrilateral (2D specialization)
References axom::utilities::abs(), and axom::primal::Quadrilateral< T, NDIMS >::signedArea().
|
inline |
Returns the signed area of a 2D quadrilateral.
The area is positive when the vertices are oriented counter-clockwise.
Compute the signed area by dividing the quadrilateral into two triangles as shown below and summing their signed area
* * D +----+ C +y * | /| * | / | ^ * | / | | * |/ | | * A +----+ B -----> +x * *
|
inline |
Returns the volume of the quadrilateral (synonym for area())
References axom::primal::Quadrilateral< T, NDIMS >::area().
|
inline |
Returns the signed volume of a 2D quadrilateral (synonym for signedArea())
References axom::primal::Quadrilateral< T, NDIMS >::signedArea().
|
inline |
Simple formatted print of a quadrilateral instance.
os | The output stream to write to |
|
staticconstexpr |
|
staticconstexpr |