AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::primal::Octahedron< T, NDIMS > Class Template Reference

Represents an octahedral geometric shape defined by six points. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/primal/geometry/Octahedron.hpp>

Public Types

using PointType = Point< T, NDIMS >
 
using VectorType = Vector< T, NDIMS >
 

Public Member Functions

AXOM_HOST_DEVICE Octahedron ()
 Default Octahedron constructor. Creates a degenerate octahedron. More...
 
AXOM_HOST_DEVICE Octahedron (const PointType &p, const PointType &q, const PointType &r, const PointType &s, const PointType &t, const PointType &u)
 Creates an octahedron from the 6 points p,q,r,s,t,u. More...
 
AXOM_HOST_DEVICE Octahedron (const PointType *pts)
 Octahedron constructor from an array of Points. More...
 
AXOM_HOST_DEVICE Octahedron (const axom::ArrayView< PointType > pts)
 Octahedron constructor from an Array of Points. More...
 
AXOM_HOST_DEVICE Octahedron (std::initializer_list< PointType > pts)
 Octahedron constructor from an initializer list of Points. More...
 
AXOM_HOST_DEVICE PointTypeoperator[] (int idx)
 Index operator to get the i^th vertex. More...
 
AXOM_HOST_DEVICE const PointTypeoperator[] (int idx) const
 Index operator to get the i^th vertex. More...
 
AXOM_HOST_DEVICE bool equals (const Octahedron &other, double eps=1.e-24) const
 Test if this Octahedron is equal to another, within a tolerance. More...
 
std::ostream & print (std::ostream &os) const
 Simple formatted print of an octahedron instance. More...
 

Static Public Attributes

static constexpr int NUM_VERTS = 6
 

Detailed Description

template<typename T, int NDIMS = 3>
class axom::primal::Octahedron< T, NDIMS >

Represents an octahedral geometric shape defined by six points.

Template Parameters
Tthe coordinate type, e.g., double, float, etc.
NDIMSthe number of spatial dimensions

There are six vertices in the octahedron, labelled P through U as the constructor's arguments. They are accessible using the square-brackets operator, with P being index 0, Q index 1, through U as index 5.

Imagine a regular octahedron with two parallel triangles, top and bottom— the end-caps, as it were. If you look "down", normal to the end-cap triangles, you will see that the vertices of the top triangle protrude beyond the edges of the bottom triangle (and vice versa). Here's a diagram showing just the end-cap triangles, omitting the other edges for clarity.

*
*         P
*         /\
*    Q -------- U
*      \      /
*      /\    /\
*    R --\  /-- T
*         \/
*         S
*
* 

Now imagine looking from the side, edge-on to the end-caps. If you unroll the "side-wall" triangles, you get a triangle strip. Here's another diagram showing just the triangle strip, with the same points labeled. Points P and Q are repeated so we can show all eight faces.

*
*        Q --- S --- U --- Q
*       / \   / \   / \   /
*      /   \ /   \ /   \ /
*     P --- R --- T --- P
*
* 

Member Typedef Documentation

◆ PointType

template<typename T , int NDIMS = 3>
using axom::primal::Octahedron< T, NDIMS >::PointType = Point<T, NDIMS>

◆ VectorType

template<typename T , int NDIMS = 3>
using axom::primal::Octahedron< T, NDIMS >::VectorType = Vector<T, NDIMS>

Constructor & Destructor Documentation

◆ Octahedron() [1/5]

template<typename T , int NDIMS = 3>
AXOM_HOST_DEVICE axom::primal::Octahedron< T, NDIMS >::Octahedron ( )
inline

Default Octahedron constructor. Creates a degenerate octahedron.

◆ Octahedron() [2/5]

template<typename T , int NDIMS = 3>
AXOM_HOST_DEVICE axom::primal::Octahedron< T, NDIMS >::Octahedron ( const PointType p,
const PointType q,
const PointType r,
const PointType s,
const PointType t,
const PointType u 
)
inline

Creates an octahedron from the 6 points p,q,r,s,t,u.

Parameters
[in]Pointcorresponding to vertex p of the octahedron.
[in]Pointcorresponding to vertex q of the octahedron.
[in]Pointcorresponding to vertex r of the octahedron.
[in]Pointcorresponding to vertex s of the octahedron.
[in]Pointcorresponding to vertex t of the octahedron.
[in]Pointcorresponding to vertex u of the octahedron.

p is opposite s, q is opposite t, r is opposite u.

◆ Octahedron() [3/5]

template<typename T , int NDIMS = 3>
AXOM_HOST_DEVICE axom::primal::Octahedron< T, NDIMS >::Octahedron ( const PointType pts)
inlineexplicit

Octahedron constructor from an array of Points.

Parameters
[in]ptsAn array containing at least 6 Points.
Note
It is the responsiblity of the caller to pass an array with at least 6 Points

References axom::primal::Octahedron< T, NDIMS >::NUM_VERTS.

◆ Octahedron() [4/5]

template<typename T , int NDIMS = 3>
AXOM_HOST_DEVICE axom::primal::Octahedron< T, NDIMS >::Octahedron ( const axom::ArrayView< PointType pts)
inlineexplicit

Octahedron constructor from an Array of Points.

Parameters
[in]ptsAn ArrayView containing at 6 Points.

References axom::primal::Octahedron< T, NDIMS >::NUM_VERTS, axom::ArrayView< T, DIM, SPACE >::size(), and SLIC_ASSERT.

◆ Octahedron() [5/5]

template<typename T , int NDIMS = 3>
AXOM_HOST_DEVICE axom::primal::Octahedron< T, NDIMS >::Octahedron ( std::initializer_list< PointType pts)
inlineexplicit

Octahedron constructor from an initializer list of Points.

Parameters
[in]ptsan initializer list containing 6 Points

References axom::primal::Octahedron< T, NDIMS >::NUM_VERTS, and SLIC_ASSERT.

Member Function Documentation

◆ operator[]() [1/2]

template<typename T , int NDIMS = 3>
AXOM_HOST_DEVICE PointType& axom::primal::Octahedron< T, NDIMS >::operator[] ( int  idx)
inline

Index operator to get the i^th vertex.

Parameters
idxThe index of the desired vertex
Precondition
idx is 0, 1, 2, 3, 4, or 5

References axom::primal::Octahedron< T, NDIMS >::NUM_VERTS, and SLIC_ASSERT.

◆ operator[]() [2/2]

template<typename T , int NDIMS = 3>
AXOM_HOST_DEVICE const PointType& axom::primal::Octahedron< T, NDIMS >::operator[] ( int  idx) const
inline

Index operator to get the i^th vertex.

Parameters
idxThe index of the desired vertex
Precondition
idx is 0, 1, 2, 3, 4, or 5

References axom::primal::Octahedron< T, NDIMS >::NUM_VERTS, and SLIC_ASSERT.

◆ equals()

template<typename T , int NDIMS = 3>
AXOM_HOST_DEVICE bool axom::primal::Octahedron< T, NDIMS >::equals ( const Octahedron< T, NDIMS > &  other,
double  eps = 1.e-24 
) const
inline

Test if this Octahedron is equal to another, within a tolerance.

Note
This function can be an expensive operation

References axom::primal::Octahedron< T, NDIMS >::NUM_VERTS, and axom::primal::squared_distance().

◆ print()

template<typename T , int NDIMS = 3>
std::ostream& axom::primal::Octahedron< T, NDIMS >::print ( std::ostream &  os) const
inline

Simple formatted print of an octahedron instance.

Parameters
osThe output stream to write to
Returns
A reference to the modified ostream

Member Data Documentation

◆ NUM_VERTS

template<typename T , int NDIMS = 3>
constexpr int axom::primal::Octahedron< T, NDIMS >::NUM_VERTS = 6
staticconstexpr

The documentation for this class was generated from the following file: