Describes point which is a storage for 2 same type values.
You can find more information in comments below.
template<class Type> union TPoint
{
struct
{
Type X;
Type Y;
};
Type Data[2];
bool operator==(const TPoint &other) const; // Check if equal
bool operator!=(const TPoint &other) const; // Check if unequal
const Type &operator[](const int index) const; // Get element
Type &operator[](const int index); // Get element
TPoint operator+(const Type value) const; // Move
TPoint operator+(const TPoint &other) const; // Add vectors
TPoint &operator+=(const Type value); // Move
TPoint &operator+=(const TPoint &other); // Add vectors
TPoint operator-(const Type value) const; // Move
TPoint operator-(const TPoint &other) const; // Sub vectors
TPoint &operator-=(const Type value); // Move
TPoint &operator-=(const TPoint &other); // Sub vectors
TPoint operator/(const Type value) const; // Scale
TPoint &operator/=(const Type value); // Scale
TPoint operator*(const Type value) const; // Scale
Type operator*(const TPoint &other) const; // Scalar
TPoint &operator*=(const Type value); // Scale
// Since 6.0.0
template<class DEST_TYPE> TPoint<DEST_TYPE> convert() const; // Return point with the same components but different data type
template<class DEST_TYPE> void convert(TPoint<DEST_TYPE> &dest) const; // Copy elements into the destination point converting them to new data type
bool is_equal(const TPoint &other, const Type tolerance) const; // Compare whether the point is equal to the other one with specified threshold
bool is_not_equal(const TPoint &other, const Type tolerance) const; // Compare whether the point is not equal to the other one with specified threshold
};
Namespace: | nitisa::math |
Include: | Nitisa/Modules/Math/Point.h |