Changeset 1833
- Timestamp:
- Aug 29, 2012, 10:27:53 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lol/math/math.h
r1513 r1833 65 65 } 66 66 67 static inline double lerp(double const &a, double const &b, double const &x) 68 { 69 return a + (b - a) * x; 70 } 71 static inline float lerp(float const &a, float const &b, float const &x) 72 { 73 return a + (b - a) * x; 74 } 75 76 67 77 /* These accelerated functions will be merged into the above, one day */ 68 78 double lol_sin(double); -
trunk/src/lol/math/vector.h
r1807 r1833 1230 1230 ret += a[n] * b[n]; \ 1231 1231 return ret; \ 1232 } \ 1233 tprefix \ 1234 inline tname<tf> lerp(tname<t1> const &a, tname<t2> const &b, tf x) \ 1235 { \ 1236 tname<tf> ret; \ 1237 for (size_t n = 0; n < sizeof(a) / sizeof(t1); n++) \ 1238 ret[n] = a[n] + (a[n] - b[n]) * x; \ 1239 return ret; \ 1232 1240 } 1233 1241 -
trunk/src/numeric.h
r1513 r1833 53 53 } 54 54 55 //Lerp for float 56 template <typename T1, typename T2, typename Tf> static inline T1 damp(const T1 &a, const T2 &b, const Tf &x, const Tf &dt) 57 { 58 if (dt <= .0f) 59 return a; 60 return lol::lerp(a, b, dt / (dt + x)); 61 } 62 55 63 } /* namespace lol */ 56 64
Note: See TracChangeset
for help on using the changeset viewer.