diff options
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/func.h | 10 | ||||
-rw-r--r-- | src/math/matrix.h | 2 | ||||
-rw-r--r-- | src/math/point.h | 4 | ||||
-rw-r--r-- | src/math/vector.h | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/math/func.h b/src/math/func.h index 9a417dc..2127d1a 100644 --- a/src/math/func.h +++ b/src/math/func.h @@ -118,13 +118,13 @@ inline void Swap(float &a, float &b) Mod(n, 1) = fractional part of n */ inline float Mod(float a, float m) { - return a - ((int)(a/m))*m; + return a - ( static_cast<int>(a / m) ) * m; } //! Returns a random value between 0 and 1. inline float Rand() { - return (float)rand()/RAND_MAX; + return static_cast<float>(rand()) / static_cast<float>(RAND_MAX); } //! Returns a normalized angle, that is in other words between 0 and 2 * PI @@ -153,10 +153,10 @@ inline bool TestAngle(float angle, float min, float max) //! Calculates a value (radians) proportional between a and b (degrees) inline float PropAngle(int a, int b, float p) { - float aa = (float)a * DEG_TO_RAD; - float bb = (float)b * DEG_TO_RAD; + float aa = static_cast<float>(a) * DEG_TO_RAD; + float bb = static_cast<float>(b) * DEG_TO_RAD; - return aa+p*(bb-aa); + return aa + p * (bb - aa); } //! Calculates the angle to rotate the angle \a a to the angle \a g diff --git a/src/math/matrix.h b/src/math/matrix.h index 7ee40e8..45a7d75 100644 --- a/src/math/matrix.h +++ b/src/math/matrix.h @@ -121,7 +121,7 @@ struct Matrix //! Returns the struct cast to \c float* array; use with care! inline float* Array() { - return (float*)this; + return reinterpret_cast<float*>(this); } //! Transposes the matrix diff --git a/src/math/point.h b/src/math/point.h index 740b275..ea20db9 100644 --- a/src/math/point.h +++ b/src/math/point.h @@ -71,13 +71,13 @@ struct Point //! Returns the struct cast to \c float* array; use with care! inline float* Array() { - return (float*)this; + return reinterpret_cast<float*>(this); } //! Returns the struct cast to <tt>const float*</tt> array; use with care! inline const float* Array() const { - return (const float*)this; + return reinterpret_cast<const float*>(this); } //! Returns the distance from (0,0) to the point (x,y) diff --git a/src/math/vector.h b/src/math/vector.h index 148d648..147869f 100644 --- a/src/math/vector.h +++ b/src/math/vector.h @@ -76,13 +76,13 @@ struct Vector //! Returns the struct cast to \c float* array; use with care! inline float* Array() { - return (float*)this; + return reinterpret_cast<float*>(this); } //! Returns the struct cast to <tt>const float*</tt> array; use with care! inline const float* Array() const { - return (const float*)this; + return reinterpret_cast<const float*>(this); } //! Returns the vector length |