![]() |
TGX 1.0.7
A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.
|
2D vector. More...
Go to the source code of this file.
Classes | |
| struct | tgx::Vec2< T > |
| Generic 2D vector [specializations iVec2, fVec2, dVec2]. More... | |
Functions | |
| template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
| Vec2< T > | tgx::normalize (Vec2< T > V) |
| Return the vector normalized to have unit norm (do nothing if the vector is 0). More... | |
| template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
| Vec2< T > | tgx::normalize_fast (Vec2< T > V) |
| Return the vector normalized to have unit norm (do nothing if the vector is 0). More... | |
| template<typename T > | |
| T | tgx::dist2 (const Vec2< T > V1, const Vec2< T > V2) |
| Compute the squared euclidian distance between two vectors. | |
| template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
| Tfloat | tgx::dist (Vec2< T > V1, const Vec2< T > V2) |
| Compute the euclidian distance between two vectors. More... | |
| template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
| Tfloat | tgx::dist_fast (Vec2< T > V1, const Vec2< T > V2) |
| Compute the euclidian distance between two vectors. More... | |
| template<typename T > | |
| Vec2< T > | tgx::operator+ (Vec2< T > V1, const Vec2< T > V2) |
| Addition operator. More... | |
| template<typename T > | |
| Vec2< T > | tgx::operator- (Vec2< T > V1, const Vec2< T > V2) |
| Substraction operator. More... | |
| template<typename T > | |
| Vec2< T > | tgx::operator* (Vec2< T > V1, const Vec2< T > V2) |
| Multiplication operator. More... | |
| template<typename T > | |
| Vec2< T > | tgx::operator/ (Vec2< T > V1, const Vec2< T > V2) |
| Division operator. More... | |
| template<typename T > | |
| Vec2< T > | tgx::operator+ (const T a, Vec2< T > V) |
| Scalar addition operator. | |
| template<typename T > | |
| Vec2< T > | tgx::operator+ (Vec2< T > V, const T a) |
| Scalar addition operator. | |
| template<typename T > | |
| Vec2< T > | tgx::operator- (const T a, Vec2< T > V) |
| Scalar substraction operator. | |
| template<typename T > | |
| Vec2< T > | tgx::operator- (Vec2< T > V, const T a) |
| Scalar substraction operator. | |
| template<typename T > | |
| Vec2< T > | tgx::operator* (const T a, Vec2< T > V) |
| Scalar multiplication operator. | |
| template<typename T > | |
| Vec2< T > | tgx::operator* (Vec2< T > V, const T a) |
| Scalar multiplication operator. | |
| template<typename T > | |
| Vec2< T > | tgx::operator/ (const T a, Vec2< T > V) |
| Scalar division operator. | |
| template<typename T > | |
| Vec2< T > | tgx::operator/ (Vec2< T > V, const T a) |
| Scalar division operator. | |
| template<typename T > | |
| T | tgx::dotProduct (const Vec2< T > U, const Vec2< T > V) |
| Return the dot product U.V between two vectors. | |
| template<typename T > | |
| T | tgx::crossProduct (const Vec2< T > &U, const Vec2< T > &V) |
| Return the cross product UxV (i.e. More... | |
| template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
| Vec2< T > | tgx::lerp (Tfloat alpha, Vec2< T > V1, Vec2< T > V2) |
| Return the linear interpolation: V1 + alpha(V2 - V1). | |
2D vector.
|
inline |
Return the vector normalized to have unit norm (do nothing if the vector is 0).
| Tfloat | Floating point type used for computation (use default floating point type if unspecified). |
|
inline |
Return the vector normalized to have unit norm (do nothing if the vector is 0).
Use fast_invsqrt() approximation to speedup computations.
| Tfloat | Floating point type used for computation (use default floating point type if unspecified). |
| Tfloat tgx::dist | ( | Vec2< T > | V1, |
| const Vec2< T > | V2 | ||
| ) |
Compute the euclidian distance between two vectors.
| Tfloat | Floating point type used for computation (use default floating point type if unspecified). |
| Tfloat tgx::dist_fast | ( | Vec2< T > | V1, |
| const Vec2< T > | V2 | ||
| ) |
Compute the euclidian distance between two vectors.
Use fast_sqrt() approximation to speedup computations.
| Tfloat | Floating point type used for computation (use default floating point type if unspecified). |
Addition operator.
Coordinates by coordinates
Substraction operator.
Coordinates by coordinates
Multiplication operator.
Coordinates by coordinates
Division operator.
Coordinates by coordinates