Tizen Native API
6.0
|
A three dimensional vector. More...
Public Member Functions | |
Vector3 () | |
Constructor. | |
Vector3 (float x, float y, float z) | |
Constructor. | |
Vector3 (const float *array) | |
Conversion constructor from an array of three floats. | |
Vector3 (const Vector2 &vec2) | |
Constructor. | |
Vector3 (const Vector4 &vec4) | |
Constructor. | |
Vector3 & | operator= (const float *array) |
Assignment operator. | |
Vector3 & | operator= (const Vector2 &rhs) |
Assignment operator. | |
Vector3 & | operator= (const Vector4 &rhs) |
Assignment operator. | |
Vector3 | operator+ (const Vector3 &rhs) const |
Addition operator. | |
Vector3 & | operator+= (const Vector3 &rhs) |
Addition assignment operator. | |
Vector3 | operator- (const Vector3 &rhs) const |
Subtraction operator. | |
Vector3 & | operator-= (const Vector3 &rhs) |
Subtraction assignment operator. | |
Vector3 | operator* (const Vector3 &rhs) const |
Multiplication operator. | |
Vector3 | operator* (float rhs) const |
Multiplication operator. | |
Vector3 & | operator*= (const Vector3 &rhs) |
Multiplication assignment operator. | |
Vector3 & | operator*= (float rhs) |
Multiplication assignment operator. | |
Vector3 & | operator*= (const Quaternion &rhs) |
Multiplication assignment operator. | |
Vector3 | operator/ (const Vector3 &rhs) const |
Division operator. | |
Vector3 | operator/ (float rhs) const |
Division operator. | |
Vector3 & | operator/= (const Vector3 &rhs) |
Division assignment operator. | |
Vector3 & | operator/= (float rhs) |
Division assignment operator. | |
Vector3 | operator- () const |
Unary negation operator. | |
bool | operator== (const Vector3 &rhs) const |
Equality operator. | |
bool | operator!= (const Vector3 &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 | Dot (const Vector3 &other) const |
Returns the dot product of this vector and another vector. | |
Vector3 | Cross (const Vector3 &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 () |
Sets the vector to be unit length, whilst maintaining its direction. | |
void | Clamp (const Vector3 &min, const Vector3 &max) |
Clamps the vector between minimum and maximum vectors. | |
const float * | AsFloat () const |
Returns the contents of the vector as an array of 3 floats. | |
float * | AsFloat () |
Returns the contents of the vector as an array of 3 floats. | |
const Vector2 & | GetVectorXY () const |
Returns the x & y components (or width & height, or r & g) as a Vector2. | |
Vector2 & | GetVectorXY () |
Returns the x & y components (or width & height, or r & g) as a Vector2. | |
const Vector2 & | GetVectorYZ () const |
Returns the y & z components (or height & depth, or g & b) as a Vector2. | |
Vector2 & | GetVectorYZ () |
Returns the y & z components (or height & depth, or g & b) as a Vector2. | |
Static Public Attributes | |
static const Vector3 | ONE |
(1.0f,1.0f,1.0f) | |
static const Vector3 | XAXIS |
Vector representing the X axis. | |
static const Vector3 | YAXIS |
Vector representing the Y axis. | |
static const Vector3 | ZAXIS |
Vector representing the Z axis. | |
static const Vector3 | NEGATIVE_XAXIS |
Vector representing the negative X axis. | |
static const Vector3 | NEGATIVE_YAXIS |
Vector representing the negative Y axis. | |
static const Vector3 | NEGATIVE_ZAXIS |
Vector representing the negative Z axis. | |
static const Vector3 | ZERO |
(0.0f, 0.0f, 0.0f) |
Detailed Description
A three dimensional vector.
- Since:
- 3.0, DALi version 1.0.0
Constructor & Destructor Documentation
Constructor.
- Since:
- 3.0, DALi version 1.0.0
Dali::Vector3::Vector3 | ( | float | x, |
float | y, | ||
float | z | ||
) | [explicit] |
Constructor.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] x (or width) component [in] y (or height) component [in] z (or depth) component
Dali::Vector3::Vector3 | ( | const float * | array | ) | [explicit] |
Conversion constructor from an array of three floats.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] array Array of xyz
Dali::Vector3::Vector3 | ( | const Vector2 & | vec2 | ) | [explicit] |
Dali::Vector3::Vector3 | ( | const Vector4 & | vec4 | ) | [explicit] |
Member Function Documentation
const float* Dali::Vector3::AsFloat | ( | ) | const |
Returns the contents of the vector as an array of 3 floats.
The order of the values in this array are as follows: 0: x (or width, or r) 1: y (or height, or g) 2: z (or depth, or b)
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- The vector contents as an array of 3 floats
- Note:
- inlined for performance reasons (generates less code than a function call)
float* Dali::Vector3::AsFloat | ( | ) |
Returns the contents of the vector as an array of 3 floats.
The order of the values in this array are as follows: 0: x (or width, or r) 1: y (or height, or g) 2: z (or depth, or b)
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- The vector contents as an array of 3 floats
- Note:
- inlined for performance reasons (generates less code than a function call)
void Dali::Vector3::Clamp | ( | const Vector3 & | min, |
const Vector3 & | max | ||
) |
Clamps the vector between minimum and maximum vectors.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] min The minimum vector [in] max The maximum vector
Vector3 Dali::Vector3::Cross | ( | const Vector3 & | 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:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] other The other vector
- Returns:
- The cross product
float Dali::Vector3::Dot | ( | const Vector3 & | 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:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] other The other vector
- Returns:
- The dot product
const Vector2& Dali::Vector3::GetVectorXY | ( | ) | const |
const Vector2& Dali::Vector3::GetVectorYZ | ( | ) | const |
float Dali::Vector3::Length | ( | ) | const |
Returns the length of the vector.
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- The length of the vector
float Dali::Vector3::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:
- 3.0, DALi version 1.0.0
- Returns:
- The length of the vector squared
void Dali::Vector3::Normalize | ( | ) |
Sets the vector to be unit length, whilst maintaining its direction.
- Since:
- 3.0, DALi version 1.0.0
bool Dali::Vector3::operator!= | ( | const Vector3 & | rhs | ) | const |
Inequality operator.
Utilizes appropriate machine epsilon values.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to test against
- Returns:
- True if the vectors are not equal
Multiplication operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to multiply
- Returns:
- A vector containing the result of the multiplication
Vector3 Dali::Vector3::operator* | ( | float | rhs | ) | const |
Multiplication operator.
- Since:
- 3.0, 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:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to multiply
- Returns:
- Itself
Vector3& Dali::Vector3::operator*= | ( | float | rhs | ) |
Multiplication assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The float value to scale the vector
- Returns:
- Itself
Vector3& Dali::Vector3::operator*= | ( | const Quaternion & | rhs | ) |
Multiplication assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The Quaternion value to multiply the vector by
- Returns:
- Itself
Addition operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs Vector to add
- Returns:
- A vector containing the result of the addition
Addition assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs Vector to add
- Returns:
- Itself
Subtraction operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to subtract
- Returns:
- A vector containing the result of the subtraction
Vector3 Dali::Vector3::operator- | ( | ) | const |
Unary negation operator.
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- A vector containing the negation
Subtraction assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to subtract
- Returns:
- Itself
Division operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to divide
- Returns:
- A vector containing the result of the division
Vector3 Dali::Vector3::operator/ | ( | float | rhs | ) | const |
Division operator.
- Since:
- 3.0, 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:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to divide
- Returns:
- Itself
Vector3& Dali::Vector3::operator/= | ( | float | rhs | ) |
Division assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The float value to scale the vector by
- Returns:
- Itself
Vector3& Dali::Vector3::operator= | ( | const float * | array | ) |
Assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] array Array of floats
- Returns:
- Itself
Assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs Vector to assign
- Returns:
- Itself
Assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs Vector to assign
- Returns:
- Itself
bool Dali::Vector3::operator== | ( | const Vector3 & | rhs | ) | const |
Equality operator.
Utilizes appropriate machine epsilon values.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The vector to test against
- Returns:
- True if the vectors are equal
const float& Dali::Vector3::operator[] | ( | const uint32_t | index | ) | const |
Const array subscript operator overload.
Asserts if index is out of range. Should be 0, 1 or 2.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] index Subscript index
- Returns:
- The float at the given index
float& Dali::Vector3::operator[] | ( | const uint32_t | index | ) |
Mutable array subscript operator overload.
Asserts if index is out of range. Should be 0, 1 or 2.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] index Subscript index
- Returns:
- The float at the given index