![]() |
TGX 1.0.3
A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.
|
3D vector. More...
Go to the source code of this file.
Classes | |
struct | tgx::Vec3< T > |
Generic 3D vector [specializations iVec3, fVec3, dVec3]. More... | |
Functions | |
template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
Vec3< T > | tgx::normalize (Vec3< 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> | |
Vec3< T > | tgx::normalize_fast (Vec3< 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 Vec3< T > V1, const Vec3< T > V2) |
Compute the squared euclidian distance between two vectors. | |
template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
Tfloat | tgx::dist (Vec3< T > V1, const Vec3< T > V2) |
Compute the euclidian distance between two vectors. More... | |
template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
Tfloat | tgx::dist_fast (Vec3< T > V1, const Vec3< T > V2) |
Compute the euclidian distance between two vectors. More... | |
template<typename T > | |
Vec3< T > | tgx::operator+ (Vec3< T > V1, const Vec3< T > V2) |
Addition operator. More... | |
template<typename T > | |
Vec3< T > | tgx::operator- (Vec3< T > V1, const Vec3< T > V2) |
Substraction operator. More... | |
template<typename T > | |
Vec3< T > | tgx::operator* (Vec3< T > V1, const Vec3< T > V2) |
Multiplication operator. More... | |
template<typename T > | |
Vec3< T > | tgx::operator/ (Vec3< T > V1, const Vec3< T > V2) |
Division operator. More... | |
template<typename T > | |
Vec3< T > | tgx::operator+ (const T a, Vec3< T > V) |
Scalar addition operator. | |
template<typename T > | |
Vec3< T > | tgx::operator+ (Vec3< T > V, const T a) |
Scalar addition operator. | |
template<typename T > | |
Vec3< T > | tgx::operator- (const T a, Vec3< T > V) |
Scalar substraction operator. | |
template<typename T > | |
Vec3< T > | tgx::operator- (Vec3< T > V, const T a) |
Scalar substraction operator. | |
template<typename T > | |
Vec3< T > | tgx::operator* (const T a, Vec3< T > V) |
Scalar multiplication operator. | |
template<typename T > | |
Vec3< T > | tgx::operator* (Vec3< T > V, const T a) |
Scalar multiplication operator. | |
template<typename T > | |
Vec3< T > | tgx::operator/ (const T a, Vec3< T > V) |
Scalar division operator. | |
template<typename T > | |
Vec3< T > | tgx::operator/ (Vec3< T > V, const T a) |
Scalar division operator. | |
template<typename T > | |
T | tgx::dotProduct (const Vec3< T > U, const Vec3< T > V) |
Return the dot product U.V between two vectors. | |
template<typename T > | |
Vec3< T > | tgx::crossProduct (const Vec3< T > &U, const Vec3< T > &V) |
Return the cross product of U x V. | |
template<typename T , typename Tfloat = typename DefaultFPType<T>::fptype> | |
Vec3< T > | tgx::lerp (Tfloat alpha, Vec3< T > V1, Vec3< T > V2) |
Linear interpolation: V1 + alpha(V2 - V1). | |
3D 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 | ( | Vec3< T > | V1, |
const Vec3< 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 | ( | Vec3< T > | V1, |
const Vec3< 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