Tizen Native API
4.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. | |
unsigned int | Dali::NextPowerOfTwo (unsigned int i) |
Returns the next power of two. | |
bool | Dali::IsPowerOfTwo (unsigned int 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, int 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 > | |
int | Dali::Sign (T value) |
Extracts the sign of a number. | |
std::ostream & | Dali::operator<< (std::ostream &o, const Matrix &matrix) |
Prints a matrix. | |
std::ostream & | Dali::operator<< (std::ostream &o, const Matrix3 &matrix) |
Prints a 3x3 matrix. | |
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. | |
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. | |
Vector2 | Dali::Clamp (const Vector2 &v, const float &min, const float &max) |
Clamps each of vector v's components between minimum and maximum values. | |
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. | |
Vector3 | Dali::Clamp (const Vector3 &v, const float &min, const float &max) |
Clamps each of vector v's components between minimum and maximum values. | |
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. | |
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< int > | Dali::Viewport |
Typedef for a viewport ( a rectangle representing a screen area ). |
Typedef Documentation
typedef Vector2 Dali::Size |
Size is an alias of Dali::Vector2.
- Since:
- 2.4, DALi version 1.0.0
typedef Rect<int> Dali::Viewport |
Typedef for a viewport ( a rectangle representing a screen area ).
- Since:
- 2.4, DALi version 1.0.0
Function Documentation
const T& Dali::Clamp | ( | const T & | value, |
const T & | min, | ||
const T & | max | ||
) |
Clamp a value.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] value The value to clamp. [in] min The minimum allowed value. [in] max The maximum allowed value.
- Returns:
- T the clamped value
Degree Dali::Clamp | ( | Degree | angle, |
float | min, | ||
float | max | ||
) |
Clamps a radian value.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
angle to clamp min value max value
- Returns:
- The resulting radian
Radian Dali::Clamp | ( | Radian | angle, |
float | min, | ||
float | max | ||
) |
Clamps a radian value.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
angle to clamp min value max value
- Returns:
- The resulting radian
Vector2 Dali::Clamp | ( | const Vector2 & | v, |
const float & | min, | ||
const float & | max | ||
) |
Clamps each of vector v's components between minimum and maximum values.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] v A vector [in] min The minimum value [in] max The maximum value
- Returns:
- A vector containing the clamped components of v
Vector3 Dali::Clamp | ( | const Vector3 & | v, |
const float & | min, | ||
const float & | max | ||
) |
Clamps each of vector v's components between minimum and maximum values.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] v A vector [in] min The minimum value [in] max The maximum value
- Returns:
- A vector containing the clamped components of v
Vector4 Dali::Clamp | ( | const Vector4 & | v, |
const float & | min, | ||
const float & | max | ||
) |
Clamps each of vector v's components between minimum and maximum values.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] v A vector [in] min The minimum value [in] max The maximum value
- Returns:
- A vector containing the clamped components of v
void Dali::ClampInPlace | ( | T & | value, |
const T & | min, | ||
const T & | max | ||
) |
Clamp a value directly.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[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.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] a the first value to compare [in] b the second value to compare
- Returns:
- true if the values are equal within a minimal epsilon for their values
bool Dali::Equals | ( | float | a, |
float | b, | ||
float | epsilon | ||
) |
Helper function to compare equality of two floating point values.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[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
- Returns:
- true if the difference between the values is less than the epsilon
bool Dali::EqualsZero | ( | float | value | ) |
Helper function to compare equality of a floating point value with zero.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] value the value to compare
- Returns:
- true if the value is equal to zero
float Dali::GetRangedEpsilon | ( | float | a, |
float | b | ||
) |
Get an epsilon that is valid for the given range.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] a the first value in the range [in] b the second value in the range.
- Returns:
- a suitable epsilon
bool Dali::IsPowerOfTwo | ( | unsigned int | i | ) |
Whether a number is power of two.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] i Input number
- Returns:
- True if i is power of two.
const T Dali::Lerp | ( | const float | offset, |
const T & | low, | ||
const T & | high | ||
) |
Linear interpolation between two values.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] offset The offset through the range low
tohigh
. This value is clamped between 0 and 1.[in] low Lowest value in range [in] high Highest value in range
- Returns:
- A value between low and high.
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.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] a A vector [in] b A vector
- Returns:
- A vector containing the maximum of each component from 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.
If a=0,1 and b=1,0 returns a vector of 1,1.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] a A vector [in] b A vector
- Returns:
- A vector containing the maximum of each component from 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.
If a=0,1,2,3 and b=4,0,1,2 returns a vector of 4,1,2,3.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] a A vector [in] b A vector
- Returns:
- A vector containing the maximum of each component from a and b
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.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] a A vector [in] b A vector
- Returns:
- A vector containing the minimum of each component from a and b
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.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] a A vector [in] b A vector
- Returns:
- A vector containing the minimum of each component from a and b
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.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] a A vector [in] b A vector
- Returns:
- A vector containing the minimum of each component from a and b
unsigned int Dali::NextPowerOfTwo | ( | unsigned int | 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.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] i Input number
- Returns:
- The next power of two or i itself in case it's a power of two
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.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] in Radian to negate
- Returns:
- The negative angle
bool Dali::operator< | ( | Radian | lhs, |
Radian | rhs | ||
) |
bool Dali::operator< | ( | Radian | lhs, |
Degree | rhs | ||
) |
bool Dali::operator< | ( | Degree | lhs, |
Radian | rhs | ||
) |
std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Matrix3 & | matrix | ||
) |
Prints a 3x3 matrix.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] o The output stream operator [in] matrix The matrix to print
- Returns:
- The output stream operator
std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Matrix & | matrix | ||
) |
Prints a matrix.
It is printed in memory order, i.e. each printed row is contiguous in memory.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] o The output stream operator [in] matrix The matrix to print
- Returns:
- The output stream operator
std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Vector2 & | vector | ||
) |
Print a Vector2.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] o The output stream operator [in] vector The vector to print
- Returns:
- The output stream operator
std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Quaternion & | quaternion | ||
) |
Prints a Quaternion.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] o The output stream operator [in] quaternion The quaternion to print
- Returns:
- The output stream operator
std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Vector3 & | vector | ||
) |
Prints a Vector3.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] o The output stream operator [in] vector The vector to print
- Returns:
- The output stream operator
std::ostream& Dali::operator<< | ( | std::ostream & | o, |
const Vector4 & | vector | ||
) |
Print a Vector4.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] o The output stream operator [in] vector The vector to print
- Returns:
- The output stream operator
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, |
int | pos | ||
) |
Get an float that is rounded at specified place of decimals.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] value float value [in] pos decimal place
- Returns:
- a rounded float
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 determining the closest object to a given point, or determining 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).
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
a the current value b the target value start the start of the domain end the end of the domain
- Returns:
- the shortest direction (the sign) and distance (the magnitude)
- Note:
- Assumes both (a) and (b) are already within the domain (start) to (end).
int Dali::Sign | ( | T | value | ) |
Extracts the sign of a number.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] value The value we want to extract the sign
- Returns:
- -1 for negative values, +1 for positive values and 0 if value is 0
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.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] x the point to be wrapped within the domain [in] start The start of the domain [in] end The end of the domain
- Returns:
- the wrapped value over the domain (start) (end)
- Note:
- If start = end (i.e. size of domain 0), then wrapping will not occur and result will always be equal to start.