[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3645 - in trunk/pingus/src: . worldmap
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3645 - in trunk/pingus/src: . worldmap |
Date: |
Fri, 4 Jul 2008 00:15:18 +0200 |
Author: grumbel
Date: 2008-07-04 00:15:17 +0200 (Fri, 04 Jul 2008)
New Revision: 3645
Modified:
trunk/pingus/src/math.cpp
trunk/pingus/src/math.hpp
trunk/pingus/src/worldmap/pingus.cpp
Log:
Moved atan2 into Math
Modified: trunk/pingus/src/math.cpp
===================================================================
--- trunk/pingus/src/math.cpp 2008-07-03 20:07:57 UTC (rev 3644)
+++ trunk/pingus/src/math.cpp 2008-07-03 22:15:17 UTC (rev 3645)
@@ -49,6 +49,11 @@
return ::floorf(x);
}
+float atan2(float x, float y)
+{
+ return ::atan2(x, y);
+}
+
} // namespace Math
/* EOF */
Modified: trunk/pingus/src/math.hpp
===================================================================
--- trunk/pingus/src/math.hpp 2008-07-03 20:07:57 UTC (rev 3644)
+++ trunk/pingus/src/math.hpp 2008-07-03 22:15:17 UTC (rev 3645)
@@ -28,8 +28,8 @@
@brief A collection of mathematical helper functions */
namespace Math {
-const float pi = 3.14159265358979323846; /* pi */
-const float pi_2 = 1.57079632679489661923; /* pi/2 */
+const float pi = 3.14159265358979323846f; /* pi */
+const float pi_2 = 1.57079632679489661923f; /* pi/2 */
// Win32 defines these are defines already, so we have to undef them
#ifdef min
@@ -90,6 +90,7 @@
float sqrt(float a);
float mod(float x, float y);
float floor(float x);
+float atan2(float x, float y);
} // namespace Math
Modified: trunk/pingus/src/worldmap/pingus.cpp
===================================================================
--- trunk/pingus/src/worldmap/pingus.cpp 2008-07-03 20:07:57 UTC (rev
3644)
+++ trunk/pingus/src/worldmap/pingus.cpp 2008-07-03 22:15:17 UTC (rev
3645)
@@ -16,7 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <iostream>
-#include <math.h>
+#include "../math.hpp"
#include "../math/vector3f.hpp"
#include "../display/drawing_context.hpp"
#include "dot.hpp"
@@ -114,8 +114,8 @@
float
Pingus::get_direction() const
{
- return (atan2(last_pos.x - pos.x,
- -(last_pos.y - pos.y)) / (float)Math::pi * 180.0f) + 180.0f;
+ return (Math::atan2(last_pos.x - pos.x,
+ -(last_pos.y - pos.y)) / (float)Math::pi * 180.0f) +
180.0f;
}
bool
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3645 - in trunk/pingus/src: . worldmap,
grumbel at BerliOS <=