Changeset 7184 for code/trunk/src/libraries/util
- Timestamp:
- Aug 18, 2010, 9:46:16 PM (14 years ago)
- Location:
- code/trunk/src/libraries/util
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/ExprParser.cc
r6417 r7184 33 33 34 34 #include "ExprParser.h" 35 35 36 #include <cmath> 36 37 #include <cstring> 37 38 #include <cstdlib> 39 #include "Math.h" 38 40 39 41 // macros for easier if, else statements … … 50 52 { 51 53 this->failed_ = false; 52 this->variables_["pi"] = 3.1415926535897932;53 this->variables_["e"] = 2.7182818284590452;54 this->variables_["pi"] = math::pi_d; 55 this->variables_["e"] = math::e_d; 54 56 } 55 57 … … 328 330 value = sqrt(parse_last_argument()); 329 331 CASE("degrees") 330 value = parse_last_argument()*180/ 3.1415926535897932;332 value = parse_last_argument()*180/math::pi_d; 331 333 CASE("radians") 332 value = parse_last_argument()* 3.1415926535897932/180;334 value = parse_last_argument()*math::pi_d/180; 333 335 CASE("mod") 334 336 { -
code/trunk/src/libraries/util/Math.cc
r6417 r7184 185 185 float distancelength = distance.length(); 186 186 if (distancelength == 0) return orxonox::Vector2(0, 0); 187 float radius = acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1)) / Ogre::Math::PI;187 float radius = acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1)) / math::pi; 188 188 189 189 if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0) -
code/trunk/src/libraries/util/Math.h
r6502 r7184 59 59 namespace orxonox 60 60 { 61 // C++ doesn't define any constants for pi, e, etc. 62 namespace math 63 { 64 const float pi = 3.14159265f; 65 const float pi_2 = 1.57079633f; 66 const float pi_4 = 7.85398163e-1f; 67 const float e = 2.71828183f; 68 const float sqrt2 = 1.41421356f; 69 const float sqrt2_2 = 7.07106781e-1f; 70 71 const double pi_d = 3.14159265358979324; 72 const double pi_2_d = 1.57079632679489662; 73 const double pi_4_d = 7.85398163397448310e-1; 74 const double e_d = 2.71828182845904524; 75 const double sqrt2_d = 1.41421356237309505; 76 const double sqrt2_2_d = 7.07106781186547524e-1; 77 } 78 61 79 #if OGRE_VERSION < 0x010603 62 80 _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian);
Note: See TracChangeset
for help on using the changeset viewer.