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/v0.7.0/src/axom/primal/geometry/Octahedron.hpp>

Public Types

enum  { NUM_OCT_VERTS = 6 }
 
using PointType = Point< T, NDIMS >
 
using VectorType = Vector< T, NDIMS >
 

Public Member Functions

AXOM_HOST_DEVICE Octahedron ()
 Default 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 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...
 

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>

Member Enumeration Documentation

◆ anonymous enum

template<typename T, int NDIMS = 3>
anonymous enum
Enumerator
NUM_OCT_VERTS 

Constructor & Destructor Documentation

◆ Octahedron() [1/2]

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

Default constructor. Creates a degenerate octahedron.

References AXOM_HOST_DEVICE.

◆ Octahedron() [2/2]

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.

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_OCT_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_HOST_DEVICE, axom::primal::Octahedron< T, NDIMS >::NUM_OCT_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.

References axom::primal::Octahedron< T, NDIMS >::NUM_OCT_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

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


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