Horizon
|
Define a general 3D-vector. More...
#include <vector3.h>
Public Types | |
typedef VECTOR3_TRAITS< T >::extended_type | extended_type |
typedef T | coord_type |
Public Member Functions | |
VECTOR3 () | |
Construct a 3D-vector with x, y = 0. | |
VECTOR3 (T x, T y, T z) | |
Construct a vector with given components x, y. | |
template<typename CastingType > | |
VECTOR3 (const VECTOR3< CastingType > &aVec) | |
Initializes a vector from another specialization. | |
VECTOR3 (const VECTOR3< T > &aVec) | |
Copy a vector. | |
VECTOR3< T > | Cross (const VECTOR3< T > &aVector) const |
Compute cross product of self with aVector. | |
VECTOR3< T >::extended_type | Dot (const VECTOR3< T > &aVector) const |
Compute the dot product of self with aVector. | |
T | EuclideanNorm () const |
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2). | |
VECTOR3< T > | Normalize () |
Compute the normalized vector. | |
bool | operator== (const VECTOR3< T > &aVector) const |
Not equality operator. | |
bool | operator!= (const VECTOR3< T > &aVector) const |
Public Attributes | |
T | x |
T | y |
T | z |
Static Public Attributes | |
static constexpr extended_type | ECOORD_MAX = std::numeric_limits<extended_type>::max() |
static constexpr extended_type | ECOORD_MIN = std::numeric_limits<extended_type>::min() |
Define a general 3D-vector.
This class uses templates to be universal. Several operators are provided to help easy implementing of linear algebra equations.
|
inline |
Initializes a vector from another specialization.
Beware of rounding issues.
T VECTOR3< T >::EuclideanNorm | ( | ) | const |
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
It is used to calculate the length of the vector.
Compute the normalized vector.
Equality operator