summaryrefslogtreecommitdiffstats
path: root/src/Vector3.h
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2014-10-11 19:32:21 +0200
committerAlexander Harkness <bearbin@gmail.com>2014-10-11 19:32:21 +0200
commit93833069a80fe4aec33a95148df39ad40671ddaf (patch)
tree2e6a335a60e618b5fe456ca8a586a2c5448c8c87 /src/Vector3.h
parentReverted submodule changes. (diff)
parentMerge pull request #1528 from kjanku1/master (diff)
downloadcuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.gz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.bz2
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.lz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.xz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.zst
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.zip
Diffstat (limited to 'src/Vector3.h')
-rw-r--r--src/Vector3.h34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/Vector3.h b/src/Vector3.h
index 1dcb38f64..1854e42e3 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -3,8 +3,6 @@
-#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
-#include <math.h>
#include <list>
#include <vector>
@@ -29,9 +27,9 @@ public:
// Hardcoded copy constructors (tolua++ does not support function templates .. yet)
- Vector3(const Vector3<float> & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {}
- Vector3(const Vector3<double> & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {}
- Vector3(const Vector3<int> & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {}
+ Vector3(const Vector3<float> & a_Rhs) : x(static_cast<T>(a_Rhs.x)), y(static_cast<T>(a_Rhs.y)), z(static_cast<T>(a_Rhs.z)) {}
+ Vector3(const Vector3<double> & a_Rhs) : x(static_cast<T>(a_Rhs.x)), y(static_cast<T>(a_Rhs.y)), z(static_cast<T>(a_Rhs.z)) {}
+ Vector3(const Vector3<int> & a_Rhs) : x(static_cast<T>(a_Rhs.x)), y(static_cast<T>(a_Rhs.y)), z(static_cast<T>(a_Rhs.z)) {}
// tolua_end
@@ -53,9 +51,9 @@ public:
{
double Len = 1.0 / Length();
- x = (T)(x * Len);
- y = (T)(y * Len);
- z = (T)(z * Len);
+ x = static_cast<T>(x * Len);
+ y = static_cast<T>(y * Len);
+ z = static_cast<T>(z * Len);
}
inline Vector3<T> NormalizeCopy(void) const
@@ -63,9 +61,9 @@ public:
double Len = 1.0 / Length();
return Vector3<T>(
- (T)(x * Len),
- (T)(y * Len),
- (T)(z * Len)
+ static_cast<T>(x * Len),
+ static_cast<T>(y * Len),
+ static_cast<T>(z * Len)
);
}
@@ -74,15 +72,15 @@ public:
double Len = 1.0 / Length();
a_Rhs.Set(
- (T)(x * Len),
- (T)(y * Len),
- (T)(z * Len)
+ static_cast<T>(x * Len),
+ static_cast<T>(y * Len),
+ static_cast<T>(z * Len)
);
}
inline double Length(void) const
{
- return sqrt((double)(x * x + y * y + z * z));
+ return sqrt(static_cast<double>(x * x + y * y + z * z));
}
inline double SqrLength(void) const
@@ -138,9 +136,9 @@ public:
inline Vector3<int> Floor(void) const
{
return Vector3<int>(
- (int)floor(x),
- (int)floor(y),
- (int)floor(z)
+ FloorC(x),
+ FloorC(y),
+ FloorC(z)
);
}