summaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 23:50:28 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 23:50:28 +0200
commit7b6bbf79c4bb73013e2fe01f84f0025e7c06c00e (patch)
tree18196404b7f9a7c000f006076030e1d568302e5d /src/math
parent7479f486b671acb2a6aea2c84a56b383aaba00ca (diff)
downloadcolobot-7b6bbf79c4bb73013e2fe01f84f0025e7c06c00e.tar.gz
colobot-7b6bbf79c4bb73013e2fe01f84f0025e7c06c00e.tar.bz2
colobot-7b6bbf79c4bb73013e2fe01f84f0025e7c06c00e.zip
Namespace and styling fix
Diffstat (limited to 'src/math')
-rw-r--r--src/math/all.h13
-rw-r--r--src/math/const.h8
-rw-r--r--src/math/func.h11
-rw-r--r--src/math/geometry.h19
-rw-r--r--src/math/intpoint.h5
-rw-r--r--src/math/matrix.h14
-rw-r--r--src/math/point.h13
-rw-r--r--src/math/test/CMakeLists.txt1
-rw-r--r--src/math/vector.h13
9 files changed, 59 insertions, 38 deletions
diff --git a/src/math/all.h b/src/math/all.h
index 0d067d3..10c17a9 100644
--- a/src/math/all.h
+++ b/src/math/all.h
@@ -21,9 +21,10 @@
#pragma once
-#include "const.h"
-#include "func.h"
-#include "point.h"
-#include "vector.h"
-#include "matrix.h"
-#include "geometry.h"
+
+#include "math/const.h"
+#include "math/func.h"
+#include "math/point.h"
+#include "math/vector.h"
+#include "math/matrix.h"
+#include "math/geometry.h"
diff --git a/src/math/const.h b/src/math/const.h
index 3f85fee..8318b7a 100644
--- a/src/math/const.h
+++ b/src/math/const.h
@@ -21,12 +21,13 @@
#pragma once
+
#include <cmath>
// Math module namespace
-namespace Math
-{
+namespace Math {
+
//! Tolerance level -- minimum accepted float value
const float TOLERANCE = 1e-6f;
@@ -50,4 +51,5 @@ const float RAD_TO_DEG = 57.29577951308232286465f;
//! Natural logarithm of 2
const float LOG_2 = log(2.0f);
-}; // namespace Math
+
+} // namespace Math
diff --git a/src/math/func.h b/src/math/func.h
index 541b084..413b5d9 100644
--- a/src/math/func.h
+++ b/src/math/func.h
@@ -22,15 +22,17 @@
#pragma once
-#include "const.h"
+
+#include "math/const.h"
+
#include <cmath>
#include <cstdlib>
// Math module namespace
-namespace Math
-{
+namespace Math {
+
//! Compares \a a and \a b within \a tolerance
inline bool IsEqual(float a, float b, float tolerance = Math::TOLERANCE)
@@ -253,4 +255,5 @@ inline float Bounce(float progress, float middle = 0.3f, float bounce = 0.4f)
}
}
-}; // namespace Math
+
+} // namespace Math
diff --git a/src/math/geometry.h b/src/math/geometry.h
index 55bc745..f086e2d 100644
--- a/src/math/geometry.h
+++ b/src/math/geometry.h
@@ -22,19 +22,21 @@
#pragma once
-#include "const.h"
-#include "func.h"
-#include "point.h"
-#include "vector.h"
-#include "matrix.h"
+
+#include "math/const.h"
+#include "math/func.h"
+#include "math/point.h"
+#include "math/matrix.h"
+#include "math/vector.h"
+
#include <cmath>
#include <cstdlib>
// Math module namespace
-namespace Math
-{
+namespace Math {
+
//! Returns py up on the line \a a - \a b
inline float MidPoint(const Math::Point &a, const Math::Point &b, float px)
@@ -617,4 +619,5 @@ inline Math::Vector RotateView(Math::Vector center, float angleH, float angleV,
return eye+center;
}
-}; // namespace Math
+
+} // namespace Math
diff --git a/src/math/intpoint.h b/src/math/intpoint.h
index 8e13b19..0f59af6 100644
--- a/src/math/intpoint.h
+++ b/src/math/intpoint.h
@@ -21,6 +21,8 @@
#pragma once
+
+// Math module namespace
namespace Math {
/**
@@ -39,4 +41,5 @@ struct IntPoint
IntPoint(int aX = 0, int aY = 0) : x(aX), y(aY) {}
};
-}; // namespace Math
+
+} // namespace Math
diff --git a/src/math/matrix.h b/src/math/matrix.h
index 30f790c..e0cf492 100644
--- a/src/math/matrix.h
+++ b/src/math/matrix.h
@@ -21,17 +21,18 @@
#pragma once
-#include "const.h"
-#include "func.h"
-#include "vector.h"
+
+#include "math/const.h"
+#include "math/func.h"
+#include "math/vector.h"
+
#include <cmath>
#include <cassert>
// Math module namespace
-namespace Math
-{
+namespace Math {
/**
* \struct Matrix math/matrix.h
@@ -459,4 +460,5 @@ inline Math::Vector MatrixVectorMultiply(const Math::Matrix &m, const Math::Vect
return Math::Vector(x, y, z);
}
-}; // namespace Math
+
+} // namespace Math
diff --git a/src/math/point.h b/src/math/point.h
index 1093c54..456fe1e 100644
--- a/src/math/point.h
+++ b/src/math/point.h
@@ -21,16 +21,18 @@
#pragma once
-#include "const.h"
-#include "func.h"
+
+#include "math/const.h"
+#include "math/func.h"
+
#include <cmath>
#include <sstream>
// Math module namespace
-namespace Math
-{
+namespace Math {
+
/**
* \struct Point
@@ -187,4 +189,5 @@ inline float Distance(const Point &a, const Point &b)
return sqrtf((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}
-}; // namespace Math
+
+} // namespace Math
diff --git a/src/math/test/CMakeLists.txt b/src/math/test/CMakeLists.txt
index 87121a0..8588bd1 100644
--- a/src/math/test/CMakeLists.txt
+++ b/src/math/test/CMakeLists.txt
@@ -5,6 +5,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x")
include_directories(
.
+../..
../../..
${GTEST_DIR}/include
)
diff --git a/src/math/vector.h b/src/math/vector.h
index 222d0cd..73e8e44 100644
--- a/src/math/vector.h
+++ b/src/math/vector.h
@@ -21,16 +21,18 @@
#pragma once
-#include "const.h"
-#include "func.h"
+
+#include "math/const.h"
+#include "math/func.h"
+
#include <cmath>
#include <sstream>
// Math module namespace
-namespace Math
-{
+namespace Math {
+
/**
* \struct Vector
@@ -277,4 +279,5 @@ inline Vector Clamp(const Vector &vec, const Vector &min, const Vector &max)
return clamped;
}
-}; // namespace Math
+
+} // namespace Math