Tizen Native API
5.0
|
Classes for basic math.
Classes | |
struct | Dali::Power< mantissa, exponent > |
Compiles time template to calculate base to the power of N. More... | |
struct | Dali::Power< mantissa, 1 > |
Compiles time template to calculate base to the power of N. More... | |
struct | Dali::Power< mantissa, 0 > |
Compiles time template to calculate base to the power of N. More... | |
struct | Dali::Log< number, base > |
Compiles time template to calculate base logarithm of N. More... | |
struct | Dali::Log< 1, base > |
Compiles time template to calculate base logarithm of N. More... | |
struct | Dali::Log< 0, base > |
Compiles time template to calculate base logarithm of N. More... | |
struct | Dali::Epsilon< N > |
Compiles time template to calculate the machine epsilon for a given floating point number. More... | |
struct | Dali::Epsilon< 1 > |
Compiles time template to calculate the machine epsilon for a given floating point number. More... | |
struct | Dali::Epsilon< 0 > |
Compiles time template to calculate the machine epsilon for a given floating point number. More... | |
struct | Dali::Degree |
An angle in degrees. More... | |
class | Dali::Matrix |
The Matrix class represents transformations and projections. More... | |
class | Dali::Matrix3 |
A 3x3 matrix. More... | |
class | Dali::Quaternion |
The Quaternion class encapsulates the mathematics of the quaternion. More... | |
struct | Dali::Radian |
An angle in radians. More... | |
class | Dali::Uint16Pair |
Simple class for passing around pairs of small unsigned integers. More... | |
struct | Dali::Vector2 |
A two dimensional vector. More... | |
struct | Dali::Vector3 |
A three dimensional vector. More... | |
struct | Dali::Vector4 |
A four dimensional vector. More... | |
Functions | |
bool | Dali::operator== (const Degree &lhs, const Degree &rhs) |
Compares equality between two degrees. | |
bool | Dali::operator!= (const Degree &lhs, const Degree &rhs) |
Compares inequality between two degrees. | |
Degree | Dali::Clamp (Degree angle, float min, float max) |
Clamps a radian value. | |
uint32_t | Dali::NextPowerOfTwo (uint32_t i) |
Returns the next power of two. | |
bool | Dali::IsPowerOfTwo (uint32_t i) |
Whether a number is power of two. | |
template<typename T > | |
const T & | Dali::Clamp (const T &value, const T &min, const T &max) |
Clamp a value. | |
template<typename T > | |
void | Dali::ClampInPlace (T &value, const T &min, const T &max) |
Clamp a value directly. | |
template<typename T > | |
const T | Dali::Lerp (const float offset, const T &low, const T &high) |
Linear interpolation between two values. | |
float | Dali::GetRangedEpsilon (float a, float b) |
Get an epsilon that is valid for the given range. | |
bool | Dali::EqualsZero (float value) |
Helper function to compare equality of a floating point value with zero. | |
bool | Dali::Equals (float a, float b) |
Helper function to compare equality of two floating point values. | |
bool | Dali::Equals (float a, float b, float epsilon) |
Helper function to compare equality of two floating point values. | |
float | Dali::Round (float value, int32_t pos) |
Get an float that is rounded at specified place of decimals. | |
float | Dali::WrapInDomain (float x, float start, float end) |
Wrap x in domain (start) to (end). | |
float | Dali::ShortestDistanceInDomain (float a, float b, float start, float end) |
Find the shortest distance (magnitude) and direction (sign) from (a) to (b) in domain (start) to (end). | |
template<typename T > | |
int32_t | Dali::Sign (T value) |
Extracts the sign of a number. | |
DALI_CORE_API std::ostream & | Dali::operator<< (std::ostream &o, const Matrix &matrix) |
Prints a matrix. | |
DALI_CORE_API std::ostream & | Dali::operator<< (std::ostream &o, const Matrix3 &matrix) |
Prints a 3x3 matrix. | |
DALI_CORE_API std::ostream & | Dali::operator<< (std::ostream &o, const Quaternion &quaternion) |
Prints a Quaternion. | |
bool | Dali::operator== (Radian lhs, Radian rhs) |
Compares equality between two radians. | |
bool | Dali::operator!= (Radian lhs, Radian rhs) |
Compares inequality between two radians. | |
bool | Dali::operator== (Radian lhs, Degree rhs) |
Compares equality between a radian and degree. | |
bool | Dali::operator!= (Radian lhs, Degree rhs) |
Compares inequality between a radian and a degree. | |
bool | Dali::operator== (Degree lhs, Radian rhs) |
Compares equality between a degree and a radian. | |
bool | Dali::operator!= (Degree lhs, Radian rhs) |
Compares inequality between a degree and a radian. | |
bool | Dali::operator> (Radian lhs, Radian rhs) |
Compares greater than between two radians. | |
bool | Dali::operator> (Radian lhs, Degree rhs) |
Compares greater than between a radian and a degree. | |
bool | Dali::operator> (Degree lhs, Radian rhs) |
Compares greater than between a radian and a degree. | |
bool | Dali::operator< (Radian lhs, Radian rhs) |
Compares less than between two radians. | |
bool | Dali::operator< (Radian lhs, Degree rhs) |
Compares less than between a radian and a degree. | |
bool | Dali::operator< (Degree lhs, Radian rhs) |
Compares less than between a degree and a radian. | |
Radian | Dali::operator* (Radian lhs, float rhs) |
Multiplies Radian with a float. | |
Radian | Dali::operator- (Radian in) |
Negates the radian. | |
Radian | Dali::Clamp (Radian angle, float min, float max) |
Clamps a radian value. | |
DALI_CORE_API std::ostream & | Dali::operator<< (std::ostream &o, const Vector2 &vector) |
Print a Vector2. | |
Vector2 | Dali::Min (const Vector2 &a, const Vector2 &b) |
Returns a vector with components set to the minimum of the corresponding component in a and b. | |
Vector2 | Dali::Max (const Vector2 &a, const Vector2 &b) |
Returns a vector with components set to the maximum of the corresponding component in a and b. | |
DALI_CORE_API Vector2 | Dali::Clamp (const Vector2 &v, const float &min, const float &max) |
Clamps each of vector v's components between minimum and maximum values. | |
DALI_CORE_API std::ostream & | Dali::operator<< (std::ostream &o, const Vector3 &vector) |
Prints a Vector3. | |
Vector3 | Dali::Min (const Vector3 &a, const Vector3 &b) |
Returns a vector with components set to the minimum of the corresponding component in a and b. | |
Vector3 | Dali::Max (const Vector3 &a, const Vector3 &b) |
Returns a vector with components set to the maximum of the corresponding component in a and b. | |
DALI_CORE_API Vector3 | Dali::Clamp (const Vector3 &v, const float &min, const float &max) |
Clamps each of vector v's components between minimum and maximum values. | |
DALI_CORE_API std::ostream & | Dali::operator<< (std::ostream &o, const Vector4 &vector) |
Print a Vector4. | |
Vector4 | Dali::Min (const Vector4 &a, const Vector4 &b) |
Returns a vector with components set to the minimum of the corresponding component in a and b. | |
Vector4 | Dali::Max (const Vector4 &a, const Vector4 &b) |
Returns a vector with components set to the maximum of the corresponding component in a and b. | |
DALI_CORE_API Vector4 | Dali::Clamp (const Vector4 &v, const float &min, const float &max) |
Clamps each of vector v's components between minimum and maximum values. | |
Namespaces | |
namespace | Dali::Random |
Provides methods to generate and use random values. | |
Typedefs | |
typedef Vector2 | Dali::Size |
Size is an alias of Dali::Vector2. | |
typedef Rect< int32_t > | Dali::Viewport |
Typedef for a viewport ( a rectangle representing a screen area ). |
typedef Vector2 Dali::Size |
Size is an alias of Dali::Vector2.
typedef Rect<int32_t> Dali::Viewport |
Typedef for a viewport ( a rectangle representing a screen area ).
const T& Dali::Clamp | ( | const T & | value, |
const T & | min, | ||
const T & | max | ||
) |
Clamp a value.
[in] | value | The value to clamp. |
[in] | min | The minimum allowed value. |
[in] | max | The maximum allowed value. |
Degree Dali::Clamp | ( | Degree | angle, |
float | min, | ||
float | max | ||
) |
Clamps a radian value.
angle | to clamp |
min | value |
max | value |
Radian Dali::Clamp | ( | Radian | angle, |
float | min, | ||
float | max | ||
) |
Clamps a radian value.
angle | to clamp |
min | value |
max | value |
DALI_CORE_API Vector2 Dali::Clamp | ( | const Vector2 & | v, |
const float & | min, | ||
const float & | max | ||
) |
Clamps each of vector v's components between minimum and maximum values.
[in] | v | A vector |
[in] | min | The minimum value |
[in] | max | The maximum value |
DALI_CORE_API Vector3 Dali::Clamp | ( | const Vector3 & | v, |
const float & | min, | ||
const float & | max | ||
) |
Clamps each of vector v's components between minimum and maximum values.
[in] | v | A vector |
[in] | min | The minimum value |
[in] | max | The maximum value |
DALI_CORE_API Vector4 Dali::Clamp | ( | const Vector4 & | v, |
const float & | min, | ||
const float & | max | ||
) |
Clamps each of vector v's components between minimum and maximum values.
[in] | v | A vector |
[in] | min | The minimum value |
[in] | max | The maximum value |
void Dali::ClampInPlace | ( | T & | value, |
const T & | min, | ||
const T & | max | ||
) |
Clamp a value directly.
[in,out] | value | The value that will be clamped. |
[in] | min | The minimum allowed value. |
[in] | max | The maximum allowed value. |
bool Dali::Equals | ( | float | a, |
float | b | ||
) |
Helper function to compare equality of two floating point values.
[in] | a | the first value to compare |
[in] | b | the second value to compare |
bool Dali::Equals | ( | float | a, |
float | b, | ||
float | epsilon | ||
) |
Helper function to compare equality of two floating point values.
[in] | a | the first value to compare |
[in] | b | the second value to compare |
[in] | epsilon | the minimum epsilon value that will be used to consider the values different |
bool Dali::EqualsZero | ( | float | value | ) |
Helper function to compare equality of a floating point value with zero.
[in] | value | the value to compare |
float Dali::GetRangedEpsilon | ( | float | a, |
float | b | ||
) |
Get an epsilon that is valid for the given range.
[in] | a | the first value in the range |
[in] | b | the second value in the range. |
bool Dali::IsPowerOfTwo | ( | uint32_t | i | ) |
Whether a number is power of two.
[in] | i | Input number |
const T Dali::Lerp | ( | const float | offset, |
const T & | low, | ||
const T & | high | ||
) |
Linear interpolation between two values.
[in] | offset | The offset through the range low to high . This value is clamped between 0 and 1. |
[in] | low | Lowest value in range |
[in] | high | Highest value in range |
Vector2 Dali::Max | ( | const Vector2 & | a, |
const Vector2 & | b | ||
) |
Returns a vector with components set to the maximum of the corresponding component in a and b.
If a=0,1 and b=1,0 returns a vector of 1,1.
[in] | a | A vector |
[in] | b | A vector |
Vector3 Dali::Max | ( | const Vector3 & | a, |
const Vector3 & | b | ||
) |
Returns a vector with components set to the maximum of the corresponding component in a and b.
If a=0,1 and b=1,0 returns a vector of 1,1.
[in] | a | A vector |
[in] | b | A vector |
Vector4 Dali::Max | ( | const Vector4 & | a, |
const Vector4 & | b | ||
) |
Returns a vector with components set to the maximum of the corresponding component in a and b.
If a=0,1,2,3 and b=4,0,1,2 returns a vector of 4,1,2,3.
[in] | a | A vector |
[in] | b | A vector |
Vector2 Dali::Min | ( | const Vector2 & | a, |
const Vector2 & | b | ||
) |
Returns a vector with components set to the minimum of the corresponding component in a and b.
If a=0,1 and b=1,0 returns a vector of 0,0.
[in] | a | A vector |
[in] | b | A vector |
Vector3 Dali::Min | ( | const Vector3 & | a, |
const Vector3 & | b | ||
) |
Returns a vector with components set to the minimum of the corresponding component in a and b.
If a=0,1,2 and b=2,1,0 returns a vector of 2,1,2.
[in] | a | A vector |
[in] | b | A vector |
Vector4 Dali::Min | ( | const Vector4 & | a, |
const Vector4 & | b | ||
) |
Returns a vector with components set to the minimum of the corresponding component in a and b.
If a=0,1,2,3 and b=4,0,1,2 returns a vector of 0,0,1,2.
[in] | a | A vector |
[in] | b | A vector |
uint32_t Dali::NextPowerOfTwo | ( | uint32_t | i | ) |
Returns the next power of two.
In case of numbers which are already a power of two this function returns the original number. If i is zero returns 1.
[in] | i | Input number |
bool Dali::operator!= | ( | const Degree & | lhs, |
const Degree & | rhs | ||
) |
bool Dali::operator!= | ( | Radian | lhs, |
Radian | rhs | ||
) |
bool Dali::operator!= | ( | Radian | lhs, |
Degree | rhs | ||
) |
bool Dali::operator!= | ( | Degree | lhs, |
Radian | rhs | ||
) |
Radian Dali::operator* | ( | Radian | lhs, |
float | rhs | ||
) |
Radian Dali::operator- | ( | Radian | in | ) |
Negates the radian.
[in] | in | Radian to negate |
bool Dali::operator< | ( | Radian | lhs, |
Radian | rhs | ||
) |
bool Dali::operator< | ( | Radian | lhs, |
Degree | rhs | ||
) |
bool Dali::operator< | ( | Degree | lhs, |
Radian | rhs | ||
) |
DALI_CORE_API std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Matrix3 & | matrix | ||
) |
Prints a 3x3 matrix.
[in] | o | The output stream operator |
[in] | matrix | The matrix to print |
DALI_CORE_API std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Matrix & | matrix | ||
) |
Prints a matrix.
It is printed in memory order.
[in] | o | The output stream operator |
[in] | matrix | The matrix to print |
DALI_CORE_API std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Vector2 & | vector | ||
) |
Print a Vector2.
[in] | o | The output stream operator |
[in] | vector | The vector to print |
DALI_CORE_API std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Quaternion & | quaternion | ||
) |
Prints a Quaternion.
[in] | o | The output stream operator |
[in] | quaternion | The quaternion to print |
DALI_CORE_API std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Vector3 & | vector | ||
) |
Prints a Vector3.
[in] | o | The output stream operator |
[in] | vector | The vector to print |
DALI_CORE_API std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Vector4 & | vector | ||
) |
Print a Vector4.
[in] | o | The output stream operator |
[in] | vector | The vector to print |
bool Dali::operator== | ( | const Degree & | lhs, |
const Degree & | rhs | ||
) |
bool Dali::operator== | ( | Radian | lhs, |
Radian | rhs | ||
) |
bool Dali::operator== | ( | Radian | lhs, |
Degree | rhs | ||
) |
bool Dali::operator== | ( | Degree | lhs, |
Radian | rhs | ||
) |
bool Dali::operator> | ( | Radian | lhs, |
Radian | rhs | ||
) |
bool Dali::operator> | ( | Radian | lhs, |
Degree | rhs | ||
) |
bool Dali::operator> | ( | Degree | lhs, |
Radian | rhs | ||
) |
float Dali::Round | ( | float | value, |
int32_t | pos | ||
) |
Get an float that is rounded at specified place of decimals.
[in] | value | float value |
[in] | pos | decimal place |
float Dali::ShortestDistanceInDomain | ( | float | a, |
float | b, | ||
float | start, | ||
float | end | ||
) |
Find the shortest distance (magnitude) and direction (sign) from (a) to (b) in domain (start) to (end).
(\ / start) (\ / end) |-a b<----|
Knowing the shortest distance is useful with wrapped domains to solve problems such as determing the closest object to a given point, or determing whether turning left or turning right is the shortest route to get from angle 10 degrees to angle 350 degrees (clearly in a 0-360 degree domain, turning left 20 degrees is quicker than turning right 340 degrees).
The value returned holds the distance and the direction from value a to value b. For instance in the above example it would return -20. i.e. subtract 20 from current value (10) to reach target wrapped value (350).
a | the current value |
b | the target value |
start | the start of the domain |
end | the end of the domain |
int32_t Dali::Sign | ( | T | value | ) |
Extracts the sign of a number.
[in] | value | The value we want to extract the sign |
float Dali::WrapInDomain | ( | float | x, |
float | start, | ||
float | end | ||
) |
Wrap x in domain (start) to (end).
This works like a floating point version of the % modulo operation. But with an offset (start).
For instance a domain is specified as: start: 2 end: 8
2 8 (\ / start) (\ / end) |----x |
The value x will be confined to this domain. If x is below 2 e.g. 0, then it is wrapped to 6. If x is above or equal to 8 e.g. 8.1 then it is wrapped to 2.1.
Domain wrapping is useful for various problems from calculating positions in a space that repeats, to computing angles that range from 0 to 360.
[in] | x | the point to be wrapped within the domain |
[in] | start | The start of the domain |
[in] | end | The end of the domain |