|
cesium-native 0.52.0
|
Mathematical constants and functions. More...
#include <CesiumUtility/Math.h>
Static Public Member Functions | |
| template<glm::length_t L, typename T, glm::qualifier Q> | |
| static constexpr glm::vec< L, T, Q > | relativeEpsilonToAbsolute (const glm::vec< L, T, Q > &a, const glm::vec< L, T, Q > &b, double relativeEpsilon) noexcept |
| Converts a relative to an absolute epsilon, for the epsilon-equality check between two values. | |
| static constexpr double | relativeEpsilonToAbsolute (double a, double b, double relativeEpsilon) noexcept |
| Converts a relative to an absolute epsilon, for the epsilon-equality check between two values. | |
| template<glm::length_t L, typename T, glm::qualifier Q> | |
| static bool constexpr | equalsEpsilon (const glm::vec< L, T, Q > &left, const glm::vec< L, T, Q > &right, double relativeEpsilon) noexcept |
| Checks whether two values are equal up to a given relative epsilon. | |
| static constexpr bool | equalsEpsilon (double left, double right, double relativeEpsilon) noexcept |
| Checks whether two values are equal up to a given relative epsilon. | |
| static constexpr bool | equalsEpsilon (double left, double right, double relativeEpsilon, double absoluteEpsilon) noexcept |
| Determines if two values are equal using an absolute or relative tolerance test. | |
| template<glm::length_t L, typename T, glm::qualifier Q> | |
| static constexpr bool | equalsEpsilon (const glm::vec< L, T, Q > &left, const glm::vec< L, T, Q > &right, double relativeEpsilon, double absoluteEpsilon) noexcept |
| Determines if two values are equal using an absolute or relative tolerance test. | |
| template<typename T, glm::qualifier Q> | |
| static constexpr bool | equalsEpsilon (const glm::mat< 4, 4, T, Q > &left, const glm::mat< 4, 4, T, Q > &right, double relativeEpsilon, double absoluteEpsilon) noexcept |
| Determines if two values are equal using an absolute or relative tolerance test. | |
| static constexpr double | sign (double value) noexcept |
| Returns the sign of the value. | |
| static constexpr double | signNotZero (double value) noexcept |
| Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. | |
| static double | negativePiToPi (double angle) noexcept |
| Produces an angle in the range -Pi <= angle <= Pi which is equivalent to the provided angle. | |
| static double | zeroToTwoPi (double angle) noexcept |
| Produces an angle in the range 0 <= angle <= 2Pi which is equivalent to the provided angle. | |
| static double | mod (double m, double n) noexcept |
| The modulo operation that also works for negative dividends. | |
| static constexpr double | degreesToRadians (double angleDegrees) noexcept |
| Converts degrees to radians. | |
| static constexpr double | radiansToDegrees (double angleRadians) noexcept |
| Converts radians to degrees. | |
| static double | lerp (double p, double q, double time) noexcept |
| Computes the linear interpolation of two values. | |
| static constexpr double | clamp (double value, double min, double max) noexcept |
| Constrain a value to lie between two values. | |
| static double | toSNorm (double value, double rangeMaximum=255.0) noexcept |
| Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMaximum]. | |
| static constexpr double | fromSNorm (double value, double rangeMaximum=255.0) noexcept |
| Converts a SNORM value in the range [0, rangeMaximum] to a scalar in the range [-1.0, 1.0]. | |
| static double | convertLongitudeRange (double angle) noexcept |
| static double | roundUp (double value, double tolerance) noexcept |
Rounds a value up to the nearest integer, like ceil, except that if the value is very close to the lower integer it is rounded down (like floor) instead. | |
| static double | roundDown (double value, double tolerance) noexcept |
Rounds a value down to the nearest integer, like floor, except that if the value is very close to the higher integer it is rounded up (like ceil) instead. | |
Static Public Attributes | |
| static constexpr double | Epsilon1 = 1e-1 |
| 0.1 | |
| static constexpr double | Epsilon2 = 1e-2 |
| 0.01 | |
| static constexpr double | Epsilon3 = 1e-3 |
| 0.001 | |
| static constexpr double | Epsilon4 = 1e-4 |
| 0.0001 | |
| static constexpr double | Epsilon5 = 1e-5 |
| 0.00001 | |
| static constexpr double | Epsilon6 = 1e-6 |
| 0.000001 | |
| static constexpr double | Epsilon7 = 1e-7 |
| 0.0000001 | |
| static constexpr double | Epsilon8 = 1e-8 |
| 0.00000001 | |
| static constexpr double | Epsilon9 = 1e-9 |
| 0.000000001 | |
| static constexpr double | Epsilon10 = 1e-10 |
| 0.0000000001 | |
| static constexpr double | Epsilon11 = 1e-11 |
| 0.00000000001 | |
| static constexpr double | Epsilon12 = 1e-12 |
| 0.000000000001 | |
| static constexpr double | Epsilon13 = 1e-13 |
| 0.0000000000001 | |
| static constexpr double | Epsilon14 = 1e-14 |
| 0.00000000000001 | |
| static constexpr double | Epsilon15 = 1e-15 |
| 0.000000000000001 | |
| static constexpr double | Epsilon16 = 1e-16 |
| 0.0000000000000001 | |
| static constexpr double | Epsilon17 = 1e-17 |
| 0.00000000000000001 | |
| static constexpr double | Epsilon18 = 1e-18 |
| 0.000000000000000001 | |
| static constexpr double | Epsilon19 = 1e-19 |
| 0.0000000000000000001 | |
| static constexpr double | Epsilon20 = 1e-20 |
| 0.00000000000000000001 | |
| static constexpr double | Epsilon21 = 1e-21 |
| 0.000000000000000000001 | |
| static constexpr double | OnePi = 3.14159265358979323846 |
| Pi. | |
| static constexpr double | TwoPi = OnePi * 2.0 |
| Two times pi. | |
| static constexpr double | PiOverTwo = OnePi / 2.0 |
| Pi divided by two. | |
| static constexpr double | PiOverFour = OnePi / 4.0 |
| Pi divided by four. | |
| static constexpr double | GoldenRatio = 1.61803398874989484 |
| The golden ratio, (1.0 + sqrt(5.0)) / 2.0. | |
|
inlinestaticconstexprnoexcept |
|
inlinestaticnoexcept |
Converts a longitude value, in radians, to the range [-Math::OnePi, Math::OnePi).
| angle | The longitude value, in radians, to convert to the range [-Math::OnePi, Math::OnePi). |
-Math::OnePi, Math::OnePi).
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
Determines if two values are equal using an absolute or relative tolerance test.
This is useful to avoid problems due to roundoff error when comparing floating-point values directly. The values are first compared using an absolute tolerance test. If that fails, a relative tolerance test is performed. Use this test if you are unsure of the magnitudes of left and right.
| T | value value type. |
| Q | The GLM qualifier type. |
| left | The first value to compare. |
| right | The other value to compare. |
| relativeEpsilon | The maximum inclusive delta between left and right for the relative tolerance test. |
| absoluteEpsilon | The maximum inclusive delta between left and right for the absolute tolerance test. |
true if the values are equal within the epsilon; otherwise, false.
|
inlinestaticconstexprnoexcept |
Checks whether two values are equal up to a given relative epsilon.
| L | The length type. |
| T | value value type. |
| Q | The GLM qualifier type. |
| left | The first value. |
| right | The second value. |
| relativeEpsilon | The relative epsilon. |
|
inlinestaticconstexprnoexcept |
Determines if two values are equal using an absolute or relative tolerance test.
This is useful to avoid problems due to roundoff error when comparing floating-point values directly. The values are first compared using an absolute tolerance test. If that fails, a relative tolerance test is performed. Use this test if you are unsure of the magnitudes of left and right.
| L | The length type. |
| T | value value type. |
| Q | The GLM qualifier type. |
| left | The first value to compare. |
| right | The other value to compare. |
| relativeEpsilon | The maximum inclusive delta between left and right for the relative tolerance test. |
| absoluteEpsilon | The maximum inclusive delta between left and right for the absolute tolerance test. |
true if the values are equal within the epsilon; otherwise, false.
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
Determines if two values are equal using an absolute or relative tolerance test.
This is useful to avoid problems due to roundoff error when comparing floating-point values directly. The values are first compared using an absolute tolerance test. If that fails, a relative tolerance test is performed. Use this test if you are unsure of the magnitudes of left and right.
| left | The first value to compare. |
| right | The other value to compare. |
| relativeEpsilon | The maximum inclusive delta between left and right for the relative tolerance test. |
| absoluteEpsilon | The maximum inclusive delta between left and right for the absolute tolerance test. |
true if the values are equal within the epsilon; otherwise, false.
|
inlinestaticconstexprnoexcept |
Converts a SNORM value in the range [0, rangeMaximum] to a scalar in the range [-1.0, 1.0].
| value | SNORM value in the range [0, rangeMaximum]. |
| rangeMaximum | The maximum value in the SNORM range, 255 by default. |
|
inlinestaticnoexcept |
Computes the linear interpolation of two values.
| p | The start value to interpolate. |
| q | The end value to interpolate. |
| time | The time of interpolation generally in the range [0.0, 1.0]. |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
Produces an angle in the range -Pi <= angle <= Pi which is equivalent to the provided angle.
| angle | The angle in radians. |
-Math::OnePi, Math::OnePi].
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
Converts a relative to an absolute epsilon, for the epsilon-equality check between two values.
| L | The length type. |
| T | value value type. |
| Q | The GLM qualifier type. |
| a | The first value. |
| b | The second value. |
| relativeEpsilon | The relative epsilon. |
|
inlinestaticconstexprnoexcept |
|
inlinestaticnoexcept |
Rounds a value down to the nearest integer, like floor, except that if the value is very close to the higher integer it is rounded up (like ceil) instead.
| value | The value to round. |
| tolerance | The tolerance. If the value is closer than this to the higher integer, it is rounded up instead. |
|
inlinestaticnoexcept |
Rounds a value up to the nearest integer, like ceil, except that if the value is very close to the lower integer it is rounded down (like floor) instead.
| value | The value to round. |
| tolerance | The tolerance. If the value is closer than this to the lower integer, it is rounded down instead. |
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative.
This is similar to Math::sign except that returns 1.0 instead of 0.0 when the input value is 0.0.
| value | The value to return the sign of. |
|
inlinestaticnoexcept |
Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMaximum].
| value | The scalar value in the range [-1.0, 1.0]. |
| rangeMaximum | The maximum value in the mapped range, 255 by default. |
|
inlinestaticnoexcept |
Produces an angle in the range 0 <= angle <= 2Pi which is equivalent to the provided angle.
| angle | The angle in radians. |
Math::TwoPi].
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |