Tizen Native API
Dali::Vector4 Struct Reference

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.
Vector4operator= (const float *array)
 Assignment operator.
Vector4operator= (const Vector2 &vec2)
 Assignment operator.
Vector4operator= (const Vector3 &vec3)
 Assignment operator.
Vector4 operator+ (const Vector4 &rhs) const
 Addition operator.
Vector4operator+= (const Vector4 &rhs)
 Addition assignment operator.
Vector4 operator- (const Vector4 &rhs) const
 Subtraction operator.
Vector4operator-= (const Vector4 &rhs)
 Subtraction assignment operator.
Vector4 operator* (const Vector4 &rhs) const
 Multiplication operator.
Vector4 operator* (float rhs) const
 Multiplication operator.
Vector4operator*= (const Vector4 &rhs)
 Multiplication assignment operator.
Vector4operator*= (float rhs)
 Multiplication assignment operator.
Vector4 operator/ (const Vector4 &rhs) const
 Division operator.
Vector4 operator/ (float rhs) const
 Division operator.
Vector4operator/= (const Vector4 &rhs)
 Division assignment operator.
Vector4operator/= (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)

Detailed Description

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)

Since :
2.4

Constructor & Destructor Documentation

Default constructor, initializes the vector to 0.

Since :
2.4
Dali::Vector4::Vector4 ( float  x,
float  y,
float  z,
float  w 
) [explicit]

Conversion constructor from four floats.

Since :
2.4
Parameters:
[in]xx or r/s component
[in]yy or g/t component
[in]zz or b/p component
[in]ww or a/q component
Dali::Vector4::Vector4 ( const float *  array) [explicit]

Conversion constructor from an array of four floats.

Since :
2.4
Parameters:
[in]arrayArray of either xyzw/rgba/stpq
Dali::Vector4::Vector4 ( const Vector2 vec2) [explicit]

Conversion constructor from Vector2.

Since :
2.4
Parameters:
[in]vec2Vector2 to copy from, z and w are initialized to 0
Dali::Vector4::Vector4 ( const Vector3 vec3) [explicit]

Conversion constructor from Vector3.

Since :
2.4
Parameters:
[in]vec3to Vector3 copy from, w is initialized to 0

Member Function Documentation

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)
Since :
2.4
Returns:
The vector contents as an array of 4 floats.
Note:
Inlined for performance reasons (generates less code than a function call)

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)
Since :
2.4
Returns:
The vector contents as an array of 4 floats.
Note:
Inlined for performance reasons (generates less code than a function call)
void Dali::Vector4::Clamp ( const Vector4 min,
const Vector4 max 
)

Clamps the vector between minimum and maximum vectors.

Since :
2.4
Parameters:
[in]minThe minimum vector
[in]maxThe 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.

Since :
2.4
Parameters:
[in]otherThe other vector
Returns:
A vector containing the cross product
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.

Since :
2.4
Parameters:
[in]otherThe other vector
Returns:
The dot product
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.

Since :
2.4
Parameters:
[in]otherThe other vector
Returns:
The dot product
float Dali::Vector4::Dot4 ( const Vector4 other) const

Returns the 4d dot product of this vector and another vector.

Since :
2.4
Parameters:
[in]otherThe other vector
Returns:
The dot product
float Dali::Vector4::Length ( ) const

Returns the length of the vector.

Since :
2.4
Returns:
The length.

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.

Since :
2.4
Returns:
The length of the vector squared.

Normalizes the vector.

Sets the vector to unit length whilst maintaining its direction.

Since :
2.4
bool Dali::Vector4::operator!= ( const Vector4 rhs) const

Inequality operator.

Utilises appropriate machine epsilon values.

Since :
2.4
Parameters:
[in]rhsThe vector to test against
Returns:
true if the vectors are not equal
Vector4 Dali::Vector4::operator* ( const Vector4 rhs) const

Multiplication operator.

Since :
2.4
Parameters:
[in]rhsThe vector to multiply
Returns:
A vector containing the result of the multiplication
Vector4 Dali::Vector4::operator* ( float  rhs) const

Multiplication operator.

Since :
2.4
Parameters:
[in]rhsThe float value to scale the vector
Returns:
A vector containing the result of the scaling
Vector4& Dali::Vector4::operator*= ( const Vector4 rhs)

Multiplication assignment operator.

Since :
2.4
Parameters:
[in]rhsThe vector to multiply
Returns:
Itself
Vector4& Dali::Vector4::operator*= ( float  rhs)

Multiplication assignment operator.

Since :
2.4
Parameters:
[in]rhsThe float value to scale the vector
Returns:
Itself
Vector4 Dali::Vector4::operator+ ( const Vector4 rhs) const

Addition operator.

Since :
2.4
Parameters:
[in]rhsVector to add.
Returns:
A vector containing the result of the addition
Vector4& Dali::Vector4::operator+= ( const Vector4 rhs)

Addition assignment operator.

Since :
2.4
Parameters:
[in]rhsVector to add.
Returns:
Itself
Vector4 Dali::Vector4::operator- ( const Vector4 rhs) const

Subtraction operator.

Since :
2.4
Parameters:
[in]rhsThe vector to subtract
Returns:
A vector containing the result of the subtraction
Vector4 Dali::Vector4::operator- ( ) const

Unary negation operator.

Since :
2.4
Returns:
The negative value
Vector4& Dali::Vector4::operator-= ( const Vector4 rhs)

Subtraction assignment operator.

Since :
2.4
Parameters:
[in]rhsThe vector to subtract
Returns:
Itself
Vector4 Dali::Vector4::operator/ ( const Vector4 rhs) const

Division operator.

Since :
2.4
Parameters:
[in]rhsThe vector to divide
Returns:
A vector containing the result of the division
Vector4 Dali::Vector4::operator/ ( float  rhs) const

Division operator.

Since :
2.4
Parameters:
[in]rhsThe float value to scale the vector by
Returns:
A vector containing the result of the scaling
Vector4& Dali::Vector4::operator/= ( const Vector4 rhs)

Division assignment operator.

Since :
2.4
Parameters:
[in]rhsThe vector to divide
Returns:
Itself
Vector4& Dali::Vector4::operator/= ( float  rhs)

Division assignment operator.

Since :
2.4
Parameters:
[in]rhsThe float value to scale the vector by
Returns:
Itself
Vector4& Dali::Vector4::operator= ( const float *  array)

Assignment operator.

Since :
2.4
Parameters:
[in]arrayArray of floats
Returns:
Itself
Vector4& Dali::Vector4::operator= ( const Vector2 vec2)

Assignment operator.

Only sets x and y. z and w are left as they were

Since :
2.4
Parameters:
[in]vec2A reference to assign from.
Returns:
Itself
Vector4& Dali::Vector4::operator= ( const Vector3 vec3)

Assignment operator.

Only sets x and y and z. w is left as it was

Since :
2.4
Parameters:
[in]vec3A reference to assign from
Returns:
Itself
bool Dali::Vector4::operator== ( const Vector4 rhs) const

Equality operator.

Utilises appropriate machine epsilon values.

Since :
2.4
Parameters:
[in]rhsThe vector to test against
Returns:
True if the vectors are equal
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

Since :
2.4
Parameters:
[in]indexSubscript index
Returns:
The float at the given 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

Since :
2.4
Parameters:
[in]indexSubscript index
Returns:
The float at the given index