+/*
+Copyright (C) 2003, 2010 - Wolfire Games
+
+This file is part of Lugaru.
+
+Lugaru is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
#ifndef _PHYSICSMATH_H_
#define _PHYSICSMATH_H_
//#include <Carbon.h>
-#ifdef WIN32
-#include "WinDefs.h"
-#endif
+#include "MacCompatibility.h"
//------------------------------------------------------------------------//
// Misc. Constants
inline Vector MakeEulerAnglesFromQ(Quaternion q)
{
- double r11, r21, r31, r32, r33, r12, r13;
+ double r11, r21, r31, r32, r33;
double q00, q11, q22, q33;
double tmp;
Vector u;
tmp = fabs(r31);
if(tmp > 0.999999)
{
- r12 = 2 * (q.v.x*q.v.y - q.n*q.v.z);
- r13 = 2 * (q.v.x*q.v.z + q.n*q.v.y);
+ double r12 = 2 * (q.v.x*q.v.y - q.n*q.v.z);
+ double r13 = 2 * (q.v.x*q.v.z + q.n*q.v.y);
u.x = RadiansToDegrees(0.0f); //roll
u.y = RadiansToDegrees((float) (-(pi/2) * r31/tmp)); // pitch
-#endif
\ No newline at end of file
+#endif