Header Generic Math Functions
(<QtMath> - Generic Math Functions)The <QtMath> header file provides various math functions. More...
Header: | #include < |
Functions
float | qDegreesToRadians(float degrees) |
double | qDegreesToRadians(double degrees) |
float | qRadiansToDegrees(float radians) |
double | qRadiansToDegrees(double radians) |
Detailed Description
These functions are partly convenience definitions for basic math operations not available in the C or Standard Template Libraries.
The header also ensures some constants specified in POSIX, but not present in C++ standards (so absent from <math.h> on some platforms), are defined:
Constant | Description |
---|---|
M_E | The base of the natural logarithms, e = exp(1) |
M_LOG2E | The base-two logarithm of e |
M_LOG10E | The base-ten logarithm of e |
M_LN2 | The natural logarithm of two |
M_LN10 | The natural logarithm of ten |
M_PI | The ratio of a circle's circumference to diameter, π |
M_PI_2 | Half M_PI, π / 2 |
M_PI_4 | Quarter M_PI, π / 4 |
M_1_PI | The inverse of M_PI, 1 / π |
M_2_PI | Twice the inverse of M_PI, 2 / π |
M_2_SQRTPI | Two divided by the square root of pi, 2 / √π |
M_SQRT2 | The square root of two, √2 |
M_SQRT1_2 | The square roof of half, 1 / √2 |
Function Documentation
float <QtMath>::qDegreesToRadians(float degrees)
This function converts the degrees in float to radians.
Example:
float degrees = 180.0f float radians = qDegreesToRadians(degrees)
This function was introduced in Qt 5.1.
See also qRadiansToDegrees().
double <QtMath>::qDegreesToRadians(double degrees)
This function converts the degrees in double to radians.
Example:
double degrees = 180.0 double radians = qDegreesToRadians(degrees)
This function was introduced in Qt 5.1.
See also qRadiansToDegrees().
float <QtMath>::qRadiansToDegrees(float radians)
This function converts the radians in float to degrees.
Example:
float radians = float(M_PI) float degrees = qRadiansToDegrees(radians)
This function was introduced in Qt 5.1.
See also qDegreesToRadians().
double <QtMath>::qRadiansToDegrees(double radians)
This function converts the radians in double to degrees.
Example:
double radians = M_PI double degrees = qRadiansToDegrees(radians)
This function was introduced in Qt 5.1.
See also qDegreesToRadians().