Tizen Native API
5.5
|
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. | |
Vector2 & | operator= (const float *array) |
Assignment operator. | |
Vector2 & | operator= (const Vector3 &rhs) |
Assignment operator. | |
Vector2 & | operator= (const Vector4 &rhs) |
Assignment operator. | |
Vector2 | operator+ (const Vector2 &rhs) const |
Addition operator. | |
Vector2 & | operator+= (const Vector2 &rhs) |
Addition assignment operator. | |
Vector2 | operator- (const Vector2 &rhs) const |
Subtraction operator. | |
Vector2 & | operator-= (const Vector2 &rhs) |
Subtraction assignment operator. | |
Vector2 | operator* (const Vector2 &rhs) const |
Multiplication operator. | |
Vector2 | operator* (float rhs) const |
Multiplication operator. | |
Vector2 & | operator*= (const Vector2 &rhs) |
Multiplication assignment operator. | |
Vector2 & | operator*= (float rhs) |
Multiplication assignment operator. | |
Vector2 | operator/ (const Vector2 &rhs) const |
Division operator. | |
Vector2 | operator/ (float rhs) const |
Division operator. | |
Vector2 & | operator/= (const Vector2 &rhs) |
Division assignment operator. | |
Vector2 & | operator/= (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 uint32_t index) const |
Const array subscript operator overload. | |
float & | operator[] (const uint32_t 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:
- 2.4, DALi version 1.0.0
Constructor & Destructor Documentation
Constructor.
- Since:
- 2.4, DALi version 1.0.0
Dali::Vector2::Vector2 | ( | float | x, |
float | y | ||
) | [explicit] |
Constructor.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] x x or width component [in] y y or height component
Dali::Vector2::Vector2 | ( | const float * | array | ) | [explicit] |
Conversion constructor from an array of two floats.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] array Array of xy
Dali::Vector2::Vector2 | ( | const Vector3 & | vec3 | ) | [explicit] |
Dali::Vector2::Vector2 | ( | const Vector4 & | vec4 | ) | [explicit] |
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:
- 2.4, 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)
float* Dali::Vector2::AsFloat | ( | ) |
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:
- 2.4, 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:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] min The minimum vector [in] max The maximum vector
float Dali::Vector2::Length | ( | ) | const |
Returns the length of the vector.
- Since:
- 2.4, DALi version 1.0.0
- Returns:
- The length of the vector
float Dali::Vector2::LengthSquared | ( | ) | const |
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:
- 2.4, DALi version 1.0.0
- Returns:
- The length of the vector squared
void Dali::Vector2::Normalize | ( | ) |
Sets the vector to be unit length, whilst maintaining its direction.
- Since:
- 2.4, DALi version 1.0.0
bool Dali::Vector2::operator!= | ( | const Vector2 & | rhs | ) | const |
Inequality operator.
Utilizes appropriate machine epsilon values.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to test against
- Returns:
- true if the vectors are not equal
Multiplication operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to multiply
- Returns:
- A vector containing the result of the multiplication
Vector2 Dali::Vector2::operator* | ( | float | rhs | ) | const |
Multiplication operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The float value to scale the vector
- Returns:
- A vector containing the result of the scaling
Multiplication assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to multiply
- Returns:
- Itself
Vector2& Dali::Vector2::operator*= | ( | float | rhs | ) |
Multiplication assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The float value to scale the vector
- Returns:
- Itself
Addition operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs Vector to add
- Returns:
- A vector containing the result of the addition
Addition assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs Vector to add
- Returns:
- Itself
Subtraction operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to subtract
- Returns:
- A vector containing the result of the subtraction
Vector2 Dali::Vector2::operator- | ( | ) | const |
Unary negation operator.
- Since:
- 2.4, DALi version 1.0.0
- Returns:
- A vector containing the negation
Subtraction assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to subtract
- Returns:
- Itself
Division operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to divide
- Returns:
- A vector containing the result of the division
Vector2 Dali::Vector2::operator/ | ( | float | rhs | ) | const |
Division operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The float value to scale the vector by
- Returns:
- A vector containing the result of the scaling
Division assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to divide
- Returns:
- Itself
Vector2& Dali::Vector2::operator/= | ( | float | rhs | ) |
Division assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The float value to scale the vector by
- Returns:
- Itself
Vector2& Dali::Vector2::operator= | ( | const float * | array | ) |
Assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] array Array of floats
- Returns:
- Itself
Assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs Vector to assign
- Returns:
- Itself
Assignment operator.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs Vector to assign
- Returns:
- Itself
bool Dali::Vector2::operator== | ( | const Vector2 & | rhs | ) | const |
Equality operator.
Utilizes appropriate machine epsilon values.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to test against
- Returns:
- true if the vectors are equal
const float& Dali::Vector2::operator[] | ( | const uint32_t | index | ) | const |
Const array subscript operator overload.
Asserts if index is out of range. Should be 0 or 1.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] index Subscript index
- Returns:
- The float at the given index
float& Dali::Vector2::operator[] | ( | const uint32_t | index | ) |
Mutable array subscript operator overload.
Asserts if index is out of range. Should be 0 or 1.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] index Subscript index
- Returns:
- The float at the given index