diff --git a/doomsday/libdeng2/include/de/math.h b/doomsday/libdeng2/include/de/math.h index 5478f8f9c9..1932ef3baf 100644 --- a/doomsday/libdeng2/include/de/math.h +++ b/doomsday/libdeng2/include/de/math.h @@ -34,7 +34,7 @@ namespace de { #undef PI -ddouble const PI = 3.14159265358979323846; +ddouble const PI = 3.1415926535897932384626433832795028841971693993751; ddouble const EPSILON = 1.0e-7; dfloat const FLOAT_EPSILON = 1.0e-5f; @@ -102,6 +102,16 @@ inline bool fequal(ddouble a, ddouble b) { return abs(a - b) < EPSILON; } +template +inline Type degreeToRadian(Type const °ree) { + return degree / Type(180) * PI; +} + +template +inline Type radianToDegree(Type const &radian) { + return radian / PI * Type(180); +} + /// General comparison function. template inline dint cmp(Type const &a, Type const &b) {