tTuple2.h provides a 2 element tuple represented by a user-provided type, which is commonly a floating or fixed point type.
The type is immutable, meaning that once constructed, no methods modify the members.
Trivial operations are provided via operator overloading.
| Operation | Math |
|---|---|
| Negation | |
| Subtraction | |
| Addition | |
| Scalar Multiplication | ![]() |
inline const tTuple2 tTuple2::absolute() const;
absolute returns the following:
inline const tTuple2 tTuple2::clamp(T minval, T maxval) const;
clamp ensures each component is within the range
inline T tPoint2::distance(const tPoint2 &other) const;
distance calculates the distance between two points, a and b:
inline T tPoint2::distanceSquared(const tPoint2 &other) const;
distanceSquared calculates the square of the distance between two points, a and b:
inline T tVector2::angle(const tVector2 &other) const;
angle calculates the angle between two vectors(in radians):
inline T tVector2::dot(const tVector2 &other) const;
dot calculates the dot/inner/scalar product:
inline T tVector2::length() const;
length calculates the length/magnitude of the vector:
inline T tVector2::lengthSquared() const;
lengthSquared calculates the square of the length/magnitude of the vector:
inline const tVector2 tVector2::unit() const;
unit returns the unit vector for this vector:
typedef tTuple2<tFloat32> tTuple2f; typedef tPoint2<tFloat32> tPoint2f; typedef tVector2<tFloat32> tVector2f; typedef tTexCoord2<tFloat32> tTexCoord2f;