Mercurial > mm7
changeset 1528:270627b54ed4
Fix Vec3<T>::Normalize_float().
author | yoctozepto |
---|---|
date | Fri, 06 Sep 2013 09:29:17 +0200 |
parents | f0551cd4cbc9 |
children | dec48a151390 |
files | VectorTypes.cpp |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/VectorTypes.cpp Fri Sep 06 09:29:12 2013 +0200 +++ b/VectorTypes.cpp Fri Sep 06 09:29:17 2013 +0200 @@ -1,6 +1,7 @@ #include <utility> #include "mm7_data.h" +#include "Math.h" //----- (004621DA) -------------------------------------------------------- uint32_t int_get_vector_length(int32_t x, int32_t y, int32_t z) @@ -25,14 +26,14 @@ template <class T> void Vec3<T>::Normalize_float() { - long double x = this->x; - long double y = this->y; - long double z = this->z; - long double s = sqrtl(x * x + y * y + z * z); + double x = this->x; + double y = this->y; + double z = this->z; + double s = sqrt(x * x + y * y + z * z); - this->x = (T)(x / s); - this->y = (T)(y / s); - this->z = (T)(z / s); + this->x = bankersRounding(x / s); + this->y = bankersRounding(y / s); + this->z = bankersRounding(z / s); } //----- (0043AA99) --------------------------------------------------------