Mercurial > fife-parpg
diff engine/core/util/structures/point.h @ 646:07b1cf8e92b5
* Major improvements to fife_math.h and added corresponding Python bindings. Users now have access to FIFE's internal math functions. These functions are recommended to be used by all clients if required. Note: this may cause some problems with certain compilers. I hope this wont have to be reverted. TODO: remove the static constant globals somehow.
* Adopted the new math functions for all subsystems
* Improvements to DeviceCaps. It now detects all possible screen modes.
* User can now select 0 for their bpp and it will attempt to initialize SDL with the current screen bpp.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 13 Oct 2010 20:24:48 +0000 |
parents | 291ba2946c73 |
children | bb26a76458c6 |
line wrap: on
line diff
--- a/engine/core/util/structures/point.h Tue Oct 12 18:58:47 2010 +0000 +++ b/engine/core/util/structures/point.h Wed Oct 13 20:24:48 2010 +0000 @@ -131,7 +131,7 @@ T invLength = 1.0/length(); //TODO: get rid of this static cast - if (invLength > static_cast<T>(DBL_ZERO_TOLERANCE)) { + if (invLength > static_cast<T>(Mathd::zeroTolerance())) { x = x * invLength; y = y * invLength; } @@ -145,9 +145,9 @@ */ void rotate(T angle){ //TODO: get rid of this static cast - T theta = (angle * static_cast<T>(DBL_PI))/180; - T costheta = cos(theta); - T sintheta = sin(theta); + T theta = (angle * static_cast<T>(Mathd::pi()))/180; + T costheta = static_cast<T>(Mathd::Cos(theta)); + T sintheta = static_cast<T>(Mathd::Sin(theta)); T nx = x; T ny = y; @@ -160,9 +160,9 @@ */ void rotate(const PointType2D<T>& origin, T angle){ //TODO: get rid of this static cast - T theta = (angle * static_cast<T>(DBL_PI))/180; - T costheta = cos(theta); - T sintheta = sin(theta); + T theta = (angle * static_cast<T>(Mathd::pi()))/180; + T costheta = static_cast<T>(Mathd::Cos(theta)); + T sintheta = static_cast<T>(Mathd::Sin(theta)); T nx = x - origin.x; T ny = y - origin.y; @@ -281,7 +281,7 @@ T invLength = 1.0/length(); //TODO: get rid of this static cast - if (invLength > static_cast<T>(DBL_ZERO_TOLERANCE)) { + if (invLength > static_cast<T>(Mathd::zeroTolerance())) { x = x * invLength; y = y * invLength; z = z * invLength;