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