AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
The point class represents a point, \( p \in \mathcal{R}^d \) . It provides access methods to set and query the point coordinates. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.4.0/src/axom/primal/geometry/Point.hpp>
Public Types | |
enum | { DIMENSION = NDIMS, NBYTES = NDIMS * sizeof(T) } |
typedef Point< T, NDIMS > | PointType |
typedef T | CoordType |
Public Member Functions | |
AXOM_HOST_DEVICE | Point (T val=T(), int sz=NDIMS) |
Fill the first sz coordinates with val and zeros the rest. More... | |
AXOM_HOST_DEVICE | Point (const NumericArray< T, NDIMS > &arr) |
Constructor from a numeric array. More... | |
AXOM_HOST_DEVICE | Point (const T *vals, int sz=NDIMS) |
Creates a point from the first sz values of the input array. More... | |
AXOM_HOST_DEVICE | Point (const Point &other) |
Copy constructor. More... | |
AXOM_HOST_DEVICE | ~Point () |
Destructor. More... | |
AXOM_HOST_DEVICE Point & | operator= (const Point &rhs) |
Assignment operator. More... | |
AXOM_HOST_DEVICE const NumericArray< T, NDIMS > & | array () const |
Returns a reference to the underlying NumericArray. More... | |
AXOM_HOST_DEVICE NumericArray< T, NDIMS > & | array () |
void | to_array (T *arr) const |
Output the point's coordinates to the array. More... | |
std::ostream & | print (std::ostream &os) const |
Simple formatted print of a point instance. More... | |
Overloaded [] operator methods | |
AXOM_HOST_DEVICE const T & | operator[] (int i) const |
Access operator for individual components. More... | |
AXOM_HOST_DEVICE T & | operator[] (int i) |
Raw data member access methods | |
const T * | data () const |
Returns a pointer to the underlying data. More... | |
T * | data () |
Static Public Member Functions | |
static int | dimension () |
Returns the dimension of this point instance. More... | |
static AXOM_HOST_DEVICE Point | make_point (const T &x, const T &y, const T &z=0.0) |
Utility function to constructs a Point with the given coordinates. More... | |
static Point | midpoint (const Point &A, const Point &B) |
Returns the midpoint between point A and point B. More... | |
static Point | lerp (const Point &A, const Point &B, T alpha) |
Performs linear interpolation/extrapolation between two points. More... | |
static Point | zero () |
Helper function to return a point whose coordinates are all 0. More... | |
static Point | ones () |
Helper function to return a point whose coordinates are all 1 This is equivalent to using the single value constructor: Point(1) (with the appropriate casting) and is only valid for Points with a numerical type (i.e. where static_cast<T>(1) is valid. More... | |
Friends | |
bool | operator== (const Point &lhs, const Point &rhs) |
Equality comparison operator for points. More... | |
bool | operator!= (const Point &lhs, const Point &rhs) |
Inequality operator for points. More... | |
The point class represents a point, \( p \in \mathcal{R}^d \) . It provides access methods to set and query the point coordinates.
T | the coordinate type, e.g., double, float, etc. |
NDIMS | the number of dimensions |
typedef Point<T, NDIMS> axom::primal::Point< T, NDIMS >::PointType |
typedef T axom::primal::Point< T, NDIMS >::CoordType |
|
inlineexplicit |
Fill the first sz coordinates with val and zeros the rest.
[in] | val | The value to set the coordinates to. Defaults to zero |
[in] | sz | The number of coordinates to set to val. The rest will be set to zero. Defaults is NDIMS. If sz is greater than NDIMS, we set all coordinates to val |
Referenced by axom::primal::Point< IndexType, NDIMS >::make_point(), axom::primal::Point< IndexType, NDIMS >::ones(), and axom::primal::Point< IndexType, NDIMS >::zero().
|
inline |
Constructor from a numeric array.
[in] | arr | The numeric array to copy from |
|
inline |
Creates a point from the first sz values of the input array.
[in] | vals | An array containing at least sz values |
[in] | sz | num values to copy from the vals array. Defaults to NDIMS. |
|
inline |
Copy constructor.
[in] | other | The point to copy |
|
inline |
Destructor.
|
inlinestatic |
Returns the dimension of this point instance.
|
inline |
Assignment operator.
[in] | rhs | a point instance on the right hand side. |
|
inline |
Access operator for individual components.
[in] | i | the component index to access |
|
inline |
|
inline |
Returns a pointer to the underlying data.
Referenced by axom::quest::SignedDistance< NDIMS >::computeDistance().
|
inline |
|
inline |
Returns a reference to the underlying NumericArray.
Referenced by axom::spin::RectangularLattice< NDIMS, double, int >::cellBounds(), axom::spin::ImplicitGrid< NDIMS, TheIndexType >::initialize(), axom::primal::intersect(), axom::primal::OrientedBoundingBox< T, NDIMS >::OrientedBoundingBox(), and axom::primal::BoundingBox< double, DIM >::scale().
|
inline |
|
inline |
Output the point's coordinates to the array.
arr | The array that we are outputting to. |
std::ostream & axom::primal::Point< T, NDIMS >::print | ( | std::ostream & | os | ) | const |
Simple formatted print of a point instance.
os | The output stream to write to |
Referenced by axom::primal::operator!=(), and axom::primal::operator<<().
|
inlinestatic |
Utility function to constructs a Point with the given coordinates.
[in] | x | the x–coordinate of the point. |
[in] | y | the y–coordinate of the point. |
[in] | z | the z–coordinate of the point. Default is 0.0. |
Referenced by axom::primal::BoundingBox< double, DIM >::getPoints(), and axom::primal::operator!=().
|
inlinestatic |
Returns the midpoint between point A and point B.
[in] | A | user-supplied point |
[in] | B | user-supplied point |
Referenced by axom::primal::BoundingBox< double, DIM >::getCentroid(), and axom::primal::operator!=().
|
inlinestatic |
Performs linear interpolation/extrapolation between two points.
Given points A, B and a weight \( \alpha \), this method computes point \( P\) defined by \( P = (1-\alpha) \cdot A + \alpha \cdot B\)
[in] | A | user-supplied point |
[in] | B | user-supplied point |
[in] | alpha | user-supplied scalar weight \( \alpha\) |
Referenced by axom::primal::Segment< T, NDIMS >::at(), and axom::primal::operator!=().
|
inlinestatic |
Helper function to return a point whose coordinates are all 0.
|
inlinestatic |
Helper function to return a point whose coordinates are all 1 This is equivalent to using the single value constructor: Point(1) (with the appropriate casting) and is only valid for Points with a numerical type (i.e. where static_cast<T>(1) is valid.
|
friend |
Equality comparison operator for points.
|
friend |
Inequality operator for points.