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.3.3/src/axom/primal/geometry/Point.hpp>
|
static int | dimension () |
| Returns the dimension of this point instance. More...
|
|
static 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, double 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...
|
|
template<typename T, int NDIMS>
class axom::primal::Point< T, NDIMS >
The point class represents a point, \( p \in \mathcal{R}^d \) . It provides access methods to set and query the point coordinates.
- Template Parameters
-
T | the coordinate type, e.g., double, float, etc. |
NDIMS | the number of dimensions |
◆ PointType
template<typename T, int NDIMS>
◆ CoordType
template<typename T, int NDIMS>
◆ anonymous enum
template<typename T, int NDIMS>
Enumerator |
---|
DIMENSION | |
NBYTES | |
◆ Point() [1/4]
template<typename T, int NDIMS>
◆ Point() [2/4]
template<typename T, int NDIMS>
Constructor from a numeric array.
- Parameters
-
[in] | arr | The numeric array to copy from |
◆ Point() [3/4]
template<typename T, int NDIMS>
Creates a point from the first sz values of the input array.
- Parameters
-
[in] | vals | An array containing at least sz values |
[in] | sz | num values to copy from the vals array. Defaults to NDIMS. |
- Note
- If sz is greater than NDIMS, we only take the first NDIMS values.
◆ Point() [4/4]
template<typename T, int NDIMS>
Copy constructor.
- Parameters
-
[in] | other | The point to copy |
◆ ~Point()
template<typename T, int NDIMS>
◆ dimension()
template<typename T, int NDIMS>
Returns the dimension of this point instance.
- Returns
- d the dimension of the point.
- Postcondition
- d >= 1.
◆ operator=()
template<typename T, int NDIMS>
Assignment operator.
- Parameters
-
[in] | rhs | a point instance on the right hand side. |
◆ operator[]() [1/2]
template<typename T, int NDIMS>
Access operator for individual components.
- Parameters
-
[in] | i | the component index to access |
- Returns
- p[i] the value at the given component index.
- Precondition
- (i >= 0) && (i < ndims)
◆ operator[]() [2/2]
template<typename T, int NDIMS>
◆ data() [1/2]
template<typename T, int NDIMS>
◆ data() [2/2]
template<typename T, int NDIMS>
◆ array() [1/2]
template<typename T, int NDIMS>
◆ array() [2/2]
template<typename T, int NDIMS>
◆ to_array()
template<typename T, int NDIMS>
Output the point's coordinates to the array.
- Parameters
-
arr | The array that we are outputting to. |
- Precondition
- The user needs to make sure that the array has been allocated and has sufficient space for NDIMS coordinates.
◆ print()
template<typename T , int NDIMS>
◆ make_point()
template<typename T, int NDIMS>
◆ midpoint()
template<typename T , int NDIMS>
◆ lerp()
template<typename T , int NDIMS>
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\)
- Parameters
-
[in] | A | user-supplied point |
[in] | B | user-supplied point |
[in] | alpha | user-supplied scalar weight \( \alpha\) |
- Returns
- P the computed point.
- Note
- \( \forall\alpha \in [0,1] \) this method linearly interpolates between the two points A, B.
-
\( \forall\alpha \not\in [0,1] \) the method extrapolates.
- Postcondition
- \( P==A\) when \( \alpha=0.0\)
-
\( P==B\) when \( \alpha=1.0\)
-
The return point, P, and the user-supplied points A, B are collinear.
Referenced by axom::primal::Segment< T, NDIMS >::at(), and axom::primal::operator!=().
◆ zero()
template<typename T, int NDIMS>
Helper function to return a point whose coordinates are all 0.
◆ ones()
template<typename T, int NDIMS>
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.
◆ operator==
template<typename T, int NDIMS>
bool operator== |
( |
const Point< T, NDIMS > & |
lhs, |
|
|
const Point< T, NDIMS > & |
rhs |
|
) |
| |
|
friend |
Equality comparison operator for points.
◆ operator!=
template<typename T, int NDIMS>
bool operator!= |
( |
const Point< T, NDIMS > & |
lhs, |
|
|
const Point< T, NDIMS > & |
rhs |
|
) |
| |
|
friend |
Inequality operator for points.
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.3.3/src/axom/primal/geometry/Point.hpp