Tizen Native API  3.0
Dali::Vector2 Struct Reference

A two dimensional vector. More...

Public Member Functions

 Vector2 ()
 Constructor.
 Vector2 (float x, float y)
 Constructor.
 Vector2 (const float *array)
 Conversion constructor from an array of two floats.
 Vector2 (const Vector3 &vec3)
 Constructor.
 Vector2 (const Vector4 &vec4)
 Constructor.
Vector2operator= (const float *array)
 Assignment operator.
Vector2operator= (const Vector3 &rhs)
 Assignment operator.
Vector2operator= (const Vector4 &rhs)
 Assignment operator.
Vector2 operator+ (const Vector2 &rhs) const
 Addition operator.
Vector2operator+= (const Vector2 &rhs)
 Addition assignment operator.
Vector2 operator- (const Vector2 &rhs) const
 Subtraction operator.
Vector2operator-= (const Vector2 &rhs)
 Subtraction assignment operator.
Vector2 operator* (const Vector2 &rhs) const
 Multiplication operator.
Vector2 operator* (float rhs) const
 Multiplication operator.
Vector2operator*= (const Vector2 &rhs)
 Multiplication assignment operator.
Vector2operator*= (float rhs)
 Multiplication assignment operator.
Vector2 operator/ (const Vector2 &rhs) const
 Division operator.
Vector2 operator/ (float rhs) const
 Division operator.
Vector2operator/= (const Vector2 &rhs)
 Division assignment operator.
Vector2operator/= (float rhs)
 Division assignment operator.
Vector2 operator- () const
 Unary negation operator.
bool operator== (const Vector2 &rhs) const
 Equality operator.
bool operator!= (const Vector2 &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 Length () const
 Returns the length of the vector.
float LengthSquared () const
 Returns the length of the vector squared.
void Normalize ()
 Sets the vector to be unit length, whilst maintaining its direction.
void Clamp (const Vector2 &min, const Vector2 &max)
 Clamps the vector between minimum and maximum vectors.
const float * AsFloat () const
 Returns the contents of the vector as an array of 2 floats.
float * AsFloat ()
 Returns the contents of the vector as an array of 2 floats.

Static Public Attributes

static const Vector2 ONE
 (1.0f,1.0f)
static const Vector2 XAXIS
 Vector representing the X axis.
static const Vector2 YAXIS
 Vector representing the Y axis.
static const Vector2 NEGATIVE_XAXIS
 Vector representing the negative X axis.
static const Vector2 NEGATIVE_YAXIS
 Vector representing the negative Y axis.
static const Vector2 ZERO
 (0.0f, 0.0f)

Detailed Description

A two dimensional vector.

Since:
3.0, DALi version 1.0.0

Constructor & Destructor Documentation

Constructor.

Since:
3.0, DALi version 1.0.0
Dali::Vector2::Vector2 ( float  x,
float  y 
) [explicit]

Constructor.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]xx or width component
[in]yy or height component
Dali::Vector2::Vector2 ( const float *  array) [explicit]

Conversion constructor from an array of two floats.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]arrayArray of xy
Dali::Vector2::Vector2 ( const Vector3 vec3) [explicit]

Constructor.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]vec3Vector3 to create this vector from
Dali::Vector2::Vector2 ( const Vector4 vec4) [explicit]

Constructor.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]vec4Vector4 to create this vector from

Member Function Documentation

const float* Dali::Vector2::AsFloat ( ) const

Returns the contents of the vector as an array of 2 floats.

The order of the values in this array are as follows: 0: x (or width) 1: y (or height)

Since:
3.0, DALi version 1.0.0
Returns:
The vector contents as an array of 2 floats
Note:
inlined for performance reasons (generates less code than a function call)

Returns the contents of the vector as an array of 2 floats.

The order of the values in this array are as follows: 0: x (or width) 1: y (or height)

Since:
3.0, DALi version 1.0.0
Returns:
The vector contents as an array of 2 floats
Note:
inlined for performance reasons (generates less code than a function call)
void Dali::Vector2::Clamp ( const Vector2 min,
const Vector2 max 
)

Clamps the vector between minimum and maximum vectors.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]minThe minimum vector
[in]maxThe maximum vector
float Dali::Vector2::Length ( ) const

Returns the length of the vector.

Since:
3.0, DALi version 1.0.0
Returns:
The length of the vector

Returns the length of the vector squared.

This is more efficient than Length() for threshold testing as it avoids the use of a square root.

Since:
3.0, DALi version 1.0.0
Returns:
The length of the vector squared

Sets the vector to be unit length, whilst maintaining its direction.

Since:
3.0, DALi version 1.0.0
bool Dali::Vector2::operator!= ( const Vector2 rhs) const

Inequality operator.

Utilizes appropriate machine epsilon values.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe vector to test against
Returns:
true if the vectors are not equal
Vector2 Dali::Vector2::operator* ( const Vector2 rhs) const

Multiplication operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe vector to multiply
Returns:
A vector containing the result of the multiplication
Vector2 Dali::Vector2::operator* ( float  rhs) const

Multiplication operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe float value to scale the vector
Returns:
A vector containing the result of the scaling
Vector2& Dali::Vector2::operator*= ( const Vector2 rhs)

Multiplication assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe vector to multiply
Returns:
Itself
Vector2& Dali::Vector2::operator*= ( float  rhs)

Multiplication assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe float value to scale the vector
Returns:
Itself
Vector2 Dali::Vector2::operator+ ( const Vector2 rhs) const

Addition operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsVector to add
Returns:
A vector containing the result of the addition
Vector2& Dali::Vector2::operator+= ( const Vector2 rhs)

Addition assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsVector to add
Returns:
Itself
Vector2 Dali::Vector2::operator- ( const Vector2 rhs) const

Subtraction operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe vector to subtract
Returns:
A vector containing the result of the subtraction
Vector2 Dali::Vector2::operator- ( ) const

Unary negation operator.

Since:
3.0, DALi version 1.0.0
Returns:
A vector containg the negation
Vector2& Dali::Vector2::operator-= ( const Vector2 rhs)

Subtraction assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe vector to subtract
Returns:
Itself
Vector2 Dali::Vector2::operator/ ( const Vector2 rhs) const

Division operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe vector to divide
Returns:
A vector containing the result of the division
Vector2 Dali::Vector2::operator/ ( float  rhs) const

Division operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe float value to scale the vector by
Returns:
A vector containing the result of the scaling
Vector2& Dali::Vector2::operator/= ( const Vector2 rhs)

Division assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe vector to divide
Returns:
Itself
Vector2& Dali::Vector2::operator/= ( float  rhs)

Division assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe float value to scale the vector by
Returns:
Itself
Vector2& Dali::Vector2::operator= ( const float *  array)

Assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]arrayArray of floats
Returns:
Itself
Vector2& Dali::Vector2::operator= ( const Vector3 rhs)

Assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsVector to assign
Returns:
Itself
Vector2& Dali::Vector2::operator= ( const Vector4 rhs)

Assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsVector to assign
Returns:
Itself
bool Dali::Vector2::operator== ( const Vector2 rhs) const

Equality operator.

Utilizes appropriate machine epsilon values.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsThe vector to test against
Returns:
true if the vectors are equal
const float& Dali::Vector2::operator[] ( const unsigned int  index) const

Const array subscript operator overload.

Asserts if index is out of range. Should be 0 or 1.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]indexSubscript index
Returns:
The float at the given index
float& Dali::Vector2::operator[] ( const unsigned int  index)

Mutable array subscript operator overload.

Asserts if index is out of range. Should be 0 or 1.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]indexSubscript index
Returns:
The float at the given index