Changeset 1745 for code/branches/core3/src/util/Math.h
- Timestamp:
- Sep 8, 2008, 11:17:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/util/Math.h
r1566 r1745 41 41 #include <OgreQuaternion.h> 42 42 #include <OgreColourValue.h> 43 #include "SubString.h" 43 44 44 45 namespace orxonox … … 64 65 _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity); 65 66 67 ///////////////////////////////////// 68 // Conversion Functions of our own // 69 ///////////////////////////////////// 70 71 // Vector2 to std::string 72 inline bool explicitConversion(std::string* output, const orxonox::Vector2& input) 73 { 74 std::ostringstream ostream; 75 if (ostream << input.x << "," << input.y) 76 { 77 (*output) = ostream.str(); 78 return true; 79 } 80 return false; 81 } 82 83 // Vector3 to std::string 84 inline bool explicitConversion(std::string* output, const orxonox::Vector3& input) 85 { 86 std::ostringstream ostream; 87 if (ostream << input.x << "," << input.y << "," << input.z) 88 { 89 (*output) = ostream.str(); 90 return true; 91 } 92 return false; 93 } 94 95 // Vector4 to std::string 96 inline bool explicitConversion(std::string* output, const orxonox::Vector4& input) 97 { 98 std::ostringstream ostream; 99 if (ostream << input.x << "," << input.y << "," << input.z << "," << input.w) 100 { 101 (*output) = ostream.str(); 102 return true; 103 } 104 return false; 105 } 106 107 // Quaternion to std::string 108 inline bool explicitConversion(std::string* output, const orxonox::Quaternion& input) 109 { 110 std::ostringstream ostream; 111 if (ostream << input.w << "," << input.x << "," << input.y << "," << input.z) 112 { 113 (*output) = ostream.str(); 114 return true; 115 } 116 return false; 117 } 118 119 // ColourValue to std::string 120 inline bool explicitConversion(std::string* output, const orxonox::ColourValue& input) 121 { 122 std::ostringstream ostream; 123 if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a) 124 { 125 (*output) = ostream.str(); 126 return true; 127 } 128 return false; 129 } 130 131 // std::string to Vector2 132 _UtilExport bool explicitConversion(orxonox::Vector2* output, const std::string& input); 133 // std::string to Vector3 134 _UtilExport bool explicitConversion(orxonox::Vector3* output, const std::string& input); 135 // std::string to Vector4 136 _UtilExport bool explicitConversion(orxonox::Vector4* output, const std::string& input); 137 // std::string to Quaternion 138 _UtilExport bool explicitConversion(orxonox::Quaternion* output, const std::string& input); 139 // std::string to ColourValue 140 _UtilExport bool explicitConversion(orxonox::ColourValue* output, const std::string& input); 141 66 142 template <typename T> 67 143 inline T sgn(T x)
Note: See TracChangeset
for help on using the changeset viewer.