Changeset 3146 for code/branches/pch/src/util/Math.h
- Timestamp:
- Jun 11, 2009, 9:40:24 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pch/src/util/Math.h
r3128 r3146 37 37 #include "UtilPrereqs.h" 38 38 39 #include <ostream>40 39 #include <string> 41 40 #include <cmath> 42 #include <boost/static_assert.hpp>43 41 44 42 #include <OgreMath.h> … … 46 44 #include <OgreVector3.h> 47 45 #include <OgreVector4.h> 48 #include <OgreMatrix3.h>49 #include <OgreMatrix4.h>50 46 #include <OgreQuaternion.h> 51 47 #include <OgreColourValue.h> … … 207 203 template <> inline orxonox::Quaternion zeroise<orxonox::Quaternion>() { return orxonox::Quaternion (0, 0, 0, 0); } 208 204 205 //! Provides zero value symbols that can be returned as reference 206 template <typename T> 207 struct NilValue 208 { 209 inline operator const T&() const 210 { 211 return value; 212 } 213 static T value; 214 }; 215 template <typename T> 216 T NilValue<T>::value = zeroise<T>(); 217 209 218 /** 210 219 @brief Interpolates between two values for a time between 0 and 1. … … 215 224 */ 216 225 template <typename T> 217 T interpolate(float time, const T& start, const T& end)226 inline T interpolate(float time, const T& start, const T& end) 218 227 { 219 228 return time * (end - start) + start; … … 228 237 */ 229 238 template <typename T> 230 T interpolateSmooth(float time, const T& start, const T& end)239 inline T interpolateSmooth(float time, const T& start, const T& end) 231 240 { 232 241 return (-2 * (end - start) * cube(time)) + (3 * (end - start) * square(time)) + start; … … 273 282 { 274 283 public: 275 IntVector2() : x(0), y(0) { }276 IntVector2(int _x, int _y) : x(_x), y(_y) { }277 int x;278 int y;284 IntVector2() : x(0), y(0) { } 285 IntVector2(int _x, int _y) : x(_x), y(_y) { } 286 int x; 287 int y; 279 288 }; 280 289 … … 282 291 { 283 292 public: 284 IntVector3() : x(0), y(0), z(0) { }285 IntVector3(int _x, int _y, int _z) : x(_x), y(_y), z(_z) { }286 int x;287 int y;288 int z;293 IntVector3() : x(0), y(0), z(0) { } 294 IntVector3(int _x, int _y, int _z) : x(_x), y(_y), z(_z) { } 295 int x; 296 int y; 297 int z; 289 298 }; 290 299 }
Note: See TracChangeset
for help on using the changeset viewer.