Tizen Native API
4.0
|
A four dimensional vector. More...
Public Member Functions | |
Vector4 () | |
Default constructor, initializes the vector to 0. | |
Vector4 (float x, float y, float z, float w) | |
Conversion constructor from four floats. | |
Vector4 (const float *array) | |
Conversion constructor from an array of four floats. | |
Vector4 (const Vector2 &vec2) | |
Conversion constructor from Vector2. | |
Vector4 (const Vector3 &vec3) | |
Conversion constructor from Vector3. | |
Vector4 & | operator= (const float *array) |
Assignment operator. | |
Vector4 & | operator= (const Vector2 &vec2) |
Assignment operator. | |
Vector4 & | operator= (const Vector3 &vec3) |
Assignment operator. | |
Vector4 | operator+ (const Vector4 &rhs) const |
Addition operator. | |
Vector4 & | operator+= (const Vector4 &rhs) |
Addition assignment operator. | |
Vector4 | operator- (const Vector4 &rhs) const |
Subtraction operator. | |
Vector4 & | operator-= (const Vector4 &rhs) |
Subtraction assignment operator. | |
Vector4 | operator* (const Vector4 &rhs) const |
Multiplication operator. | |
Vector4 | operator* (float rhs) const |
Multiplication operator. | |
Vector4 & | operator*= (const Vector4 &rhs) |
Multiplication assignment operator. | |
Vector4 & | operator*= (float rhs) |
Multiplication assignment operator. | |
Vector4 | operator/ (const Vector4 &rhs) const |
Division operator. | |
Vector4 | operator/ (float rhs) const |
Division operator. | |
Vector4 & | operator/= (const Vector4 &rhs) |
Division assignment operator. | |
Vector4 & | operator/= (float rhs) |
Division assignment operator. | |
Vector4 | operator- () const |
Unary negation operator. | |
bool | operator== (const Vector4 &rhs) const |
Equality operator. | |
bool | operator!= (const Vector4 &rhs) const |
Inequality operator. | |
const float & | operator[] (const unsigned int index) const |
Const array subscript operator overload. | |
float & | operator[] (const unsigned int index) |
Mutable array subscript operator overload. | |
float | Dot (const Vector3 &other) const |
Returns the dot product of this vector (4d) and another vector (3d). | |
float | Dot (const Vector4 &other) const |
Returns the dot product of this vector and another vector. | |
float | Dot4 (const Vector4 &other) const |
Returns the 4d dot product of this vector and another vector. | |
Vector4 | Cross (const Vector4 &other) const |
Returns the cross produce of this vector and another vector. | |
float | Length () const |
Returns the length of the vector. | |
float | LengthSquared () const |
Returns the length of the vector squared. | |
void | Normalize () |
Normalizes the vector. | |
void | Clamp (const Vector4 &min, const Vector4 &max) |
Clamps the vector between minimum and maximum vectors. | |
const float * | AsFloat () const |
Returns the contents of the vector as an array of 4 floats. | |
float * | AsFloat () |
Returns the contents of the vector as an array of 4 floats. | |
Static Public Attributes | |
static const Vector4 | ONE |
(1.0f,1.0f,1.0f,1.0f) | |
static const Vector4 | XAXIS |
(1.0f,0.0f,0.0f,0.0f) | |
static const Vector4 | YAXIS |
(0.0f,1.0f,0.0f,0.0f) | |
static const Vector4 | ZAXIS |
(0.0f,0.0f,1.0f,0.0f) | |
static const Vector4 | ZERO |
(0.0f, 0.0f, 0.0f, 0.0f) |
A four dimensional vector.
Components can be used as position or offset (x,y,z,w); color (r,g,b,a) or texture coords(s,t,p,q).
Default constructor, initializes the vector to 0.
Dali::Vector4::Vector4 | ( | float | x, |
float | y, | ||
float | z, | ||
float | w | ||
) | [explicit] |
Conversion constructor from four floats.
[in] | x | x (or r/s) component |
[in] | y | y (or g/t) component |
[in] | z | z (or b/p) component |
[in] | w | w (or a/q) component |
Dali::Vector4::Vector4 | ( | const float * | array | ) | [explicit] |
Conversion constructor from an array of four floats.
[in] | array | Array of either xyzw/rgba/stpq |
Dali::Vector4::Vector4 | ( | const Vector2 & | vec2 | ) | [explicit] |
Dali::Vector4::Vector4 | ( | const Vector3 & | vec3 | ) | [explicit] |
const float* Dali::Vector4::AsFloat | ( | ) | const |
Returns the contents of the vector as an array of 4 floats.
The order of the values in this array are as follows: 0: x (or r, or s) 1: y (or g, or t) 2: z (or b, or p) 3: w (or a, or q)
float* Dali::Vector4::AsFloat | ( | ) |
Returns the contents of the vector as an array of 4 floats.
The order of the values in this array are as follows: 0: x (or r, or s) 1: y (or g, or t) 2: z (or b, or p) 3: w (or a, or q)
void Dali::Vector4::Clamp | ( | const Vector4 & | min, |
const Vector4 & | max | ||
) |
Clamps the vector between minimum and maximum vectors.
[in] | min | The minimum vector |
[in] | max | The maximum vector |
Vector4 Dali::Vector4::Cross | ( | const Vector4 & | other | ) | const |
Returns the cross produce of this vector and another vector.
The cross produce of two vectors is a vector which is perpendicular to the plane of the two vectors. This is great for calculating normals and making matrices orthogonal.
[in] | other | The other vector |
float Dali::Vector4::Dot | ( | const Vector3 & | other | ) | const |
Returns the dot product of this vector (4d) and another vector (3d).
The dot product is the length of one vector in the direction of another vector. This is great for lighting, threshold testing the angle between two unit vectors, calculating the distance between two points in a particular direction.
[in] | other | The other vector |
float Dali::Vector4::Dot | ( | const Vector4 & | other | ) | const |
Returns the dot product of this vector and another vector.
The dot product is the length of one vector in the direction of another vector. This is great for lighting, threshold testing the angle between two unit vectors, calculating the distance between two points in a particular direction.
[in] | other | The other vector |
float Dali::Vector4::Dot4 | ( | const Vector4 & | other | ) | const |
Returns the 4d dot product of this vector and another vector.
[in] | other | The other vector |
float Dali::Vector4::Length | ( | ) | const |
Returns the length of the vector.
float Dali::Vector4::LengthSquared | ( | ) | const |
Returns the length of the vector squared.
This is faster than using Length() when performing threshold checks as it avoids use of the square root.
void Dali::Vector4::Normalize | ( | ) |
Normalizes the vector.
Sets the vector to unit length whilst maintaining its direction.
bool Dali::Vector4::operator!= | ( | const Vector4 & | rhs | ) | const |
Inequality operator.
Utilizes appropriate machine epsilon values.
[in] | rhs | The vector to test against |
Multiplication operator.
[in] | rhs | The vector to multiply |
Vector4 Dali::Vector4::operator* | ( | float | rhs | ) | const |
Multiplication operator.
[in] | rhs | The float value to scale the vector |
Multiplication assignment operator.
[in] | rhs | The vector to multiply |
Vector4& Dali::Vector4::operator*= | ( | float | rhs | ) |
Multiplication assignment operator.
[in] | rhs | The float value to scale the vector |
Addition operator.
[in] | rhs | Vector to add |
Addition assignment operator.
[in] | rhs | Vector to add |
Subtraction operator.
[in] | rhs | The vector to subtract |
Vector4 Dali::Vector4::operator- | ( | ) | const |
Unary negation operator.
Subtraction assignment operator.
[in] | rhs | The vector to subtract |
Division operator.
[in] | rhs | The vector to divide |
Vector4 Dali::Vector4::operator/ | ( | float | rhs | ) | const |
Division operator.
[in] | rhs | The float value to scale the vector by |
Division assignment operator.
[in] | rhs | The vector to divide |
Vector4& Dali::Vector4::operator/= | ( | float | rhs | ) |
Division assignment operator.
[in] | rhs | The float value to scale the vector by |
Vector4& Dali::Vector4::operator= | ( | const float * | array | ) |
Assignment operator.
[in] | array | Array of floats |
Assignment operator.
Only sets x and y. z and w are left as they were.
[in] | vec2 | A reference to assign from |
Assignment operator.
Only sets x and y and z. w is left as it was.
[in] | vec3 | A reference to assign from |
bool Dali::Vector4::operator== | ( | const Vector4 & | rhs | ) | const |
Equality operator.
Utilizes appropriate machine epsilon values.
[in] | rhs | The vector to test against |
const float& Dali::Vector4::operator[] | ( | const unsigned int | index | ) | const |
Const array subscript operator overload.
Asserts if index is out of range. Should be 0, 1, 2 or 3.
[in] | index | Subscript index |
float& Dali::Vector4::operator[] | ( | const unsigned int | index | ) |
Mutable array subscript operator overload.
Asserts if index is out of range. Should be 0, 1, 2 or 3.
[in] | index | Subscript index |