A four dimensional floating point vector template. More...
#include <ArithVec4Float.h>
Public Member Functions | |
ArithVec4Float () noexcept | |
Construct a (0,0,0,0) homogenous Vector. | |
ArithVec4Float (T a, T b, T c, T d) noexcept | |
Construct a 4D vector. | |
void | de_homogenize () |
Divide all coordinates by the fourth coordinate. | |
![]() | |
ArithVecFloat (T a) noexcept | |
ArithVecFloat (T a, T b) noexcept | |
ArithVecFloat (T a, T b, T c) noexcept | |
ArithVecFloat (T a, T b, T c, T d) noexcept | |
T | length () const |
Compute Euclidean length. | |
void | normalize () |
Normalize vector. | |
void | cond_normalize () |
Conditionally normalize vector. The condition being that the vector has non-zero length. | |
![]() | |
void | set (T _a, T _b) |
Set all coordinates of a 2D vector. | |
void | set (T _a, T _b, T _c) |
Set all coordinates of a 3D vector. | |
void | set (T _a, T _b, T _c, T _d) |
Set all coordinates of a 4D vector. | |
const T & | operator[] (unsigned int i) const |
Const index operator. | |
T & | operator[] (unsigned int i) |
Non-const index operator. | |
const T & | operator() (unsigned int i) const |
Const index operator. | |
T & | operator() (unsigned int i) |
Non-const index operator. | |
T * | get () |
const T * | get () const |
bool | operator== (const V &v) const |
Equality operator. | |
bool | operator== (T k) const |
Equality wrt scalar. True if all coords are equal to scalar. | |
bool | operator!= (const V &v) const |
Inequality operator. | |
bool | operator!= (T k) const |
Inequality wrt scalar. True if any coord not equal to scalar. | |
bool | all_l (const V &v) const |
bool | all_le (const V &v) const |
bool | all_g (const V &v) const |
bool | all_ge (const V &v) const |
const V & | operator*= (T k) |
Assignment multiplication with scalar. | |
const V & | operator/= (T k) |
Assignment division with scalar. | |
const V & | operator+= (T k) |
Assignment addition with scalar. Adds scalar to each coordinate. | |
const V & | operator-= (T k) |
Assignment subtraction with scalar. Subtracts scalar from each coord. | |
const V & | operator*= (const V &v) |
const V & | operator/= (const V &v) |
Assigment division with vector. Each coord divided independently. | |
const V & | operator+= (const V &v) |
Assignmment addition with vector. | |
const V & | operator-= (const V &v) |
Assignment subtraction with vector. | |
const V | operator- () const |
Negate vector. | |
const V | operator* (const V &v1) const |
const V | operator+ (const V &v1) const |
Add two vectors. | |
const V | operator- (const V &v1) const |
Subtract two vectors. | |
const V | operator/ (const V &v1) const |
Divide two vectors. Each coord separately. | |
const V | operator* (T k) const |
Multiply scalar onto vector. | |
const V | operator/ (T k) const |
Divide vector by scalar. | |
const T | min_coord () const |
Return the smallest coordinate of the vector. | |
const T | max_coord () const |
Return the largest coordinate of the vector. | |
Additional Inherited Members | |
![]() | |
typedef T | ScalarType |
For convenience we define a more meaningful name for the scalar type. | |
typedef V | VectorType |
A more meaningful name for vector type. | |
![]() | |
static unsigned int | get_dim () |
Return dimension of vector. | |
![]() | |
ArithVec () | |
Construct uninitialized vector. | |
ArithVec (T _a) | |
Construct a vector where all coordinates are identical. | |
ArithVec (T _a, T _b) | |
Construct a 2D vector. | |
ArithVec (T _a, T _b, T _c) | |
Construct a 3D vector. | |
ArithVec (T _a, T _b, T _c, T _d) | |
Construct a 4D vector. | |
![]() | |
T | data [N] |
The actual contents of the vector. | |
A four dimensional floating point vector template.
This class is also used (via typedef) for homogeneous vectors.