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/develop/src/axom/primal/geometry/Point.hpp>
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>
Fill the first sz coordinates with val and zeros the rest.
- Parameters
-
[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 |
◆ 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>
Creates a point from an initializer list.
- Parameters
-
[in] | values | an initializer list containing the values of the point. If the size is not the same as the size of this point, this behaves the same way as the constructor which takes a pointer and size. |
◆ dimension()
template<typename T , int NDIMS>
Returns the dimension of this point instance.
- Returns
- d the dimension of the point.
- Postcondition
- d >= 1.
◆ 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.
References axom::primal::NumericArray< T, SIZE >::to_array().
◆ print()
template<typename T , int NDIMS>
Simple formatted print of a point instance.
- Parameters
-
os | The output stream to write to |
- Returns
- A reference to the modified ostream
◆ make_point()
template<typename T , int NDIMS>
Utility function to constructs a Point with the given coordinates.
- Parameters
-
[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. |
- Returns
- p a Point instance with the given coordinates.
◆ midpoint()
template<typename T , int NDIMS>
Returns the midpoint between point A and point B.
- Parameters
-
[in] | A | user-supplied point |
[in] | B | user-supplied point |
- Returns
- p point at the midpoint A and B.
◆ 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.
◆ zero()
template<typename T , int NDIMS>
◆ 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.
References axom::primal::Point< T, NDIMS >::Point().
◆ operator==
template<typename T , int NDIMS>
Equality comparison operator for points.
◆ operator!=
template<typename T , int NDIMS>
Inequality operator for points.
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/primal/geometry/Point.hpp