summaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-08-11 18:39:16 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-08-11 18:39:16 +0200
commit1996507fd3d4d9de90de99845b71a6bf3fbe62da (patch)
tree6dca78a855a8f0eacb3aecd230d337453ebca2ce /src/math
parent7f80ca297154809523cd533edf1842ab1ae391aa (diff)
downloadcolobot-1996507fd3d4d9de90de99845b71a6bf3fbe62da.tar.gz
colobot-1996507fd3d4d9de90de99845b71a6bf3fbe62da.tar.bz2
colobot-1996507fd3d4d9de90de99845b71a6bf3fbe62da.zip
Documentation update
- updated Doxyfile - added/changed file, dir and namespace descriptions - fixed some errors in doxygen tags
Diffstat (limited to 'src/math')
-rw-r--r--src/math/README.txt13
-rw-r--r--src/math/all.h9
-rw-r--r--src/math/const.h7
-rw-r--r--src/math/func.h21
-rw-r--r--src/math/geometry.h11
-rw-r--r--src/math/intpoint.h12
-rw-r--r--src/math/matrix.h24
-rw-r--r--src/math/point.h9
-rw-r--r--src/math/vector.h9
9 files changed, 55 insertions, 60 deletions
diff --git a/src/math/README.txt b/src/math/README.txt
index 1a5ce93..fd34dcb 100644
--- a/src/math/README.txt
+++ b/src/math/README.txt
@@ -1,3 +1,12 @@
-src/math
+/**
+ * \dir math
+ * \brief Common mathematical structures and functions
+ */
-Contains common mathematical structures and functions.
+/**
+ * \namespace Math
+ * \brief Namespace for (new) math code
+ *
+ * This namespace was created to avoid clashing with old code, but now it still serves,
+ * defining a border between math and non-math-related code.
+ */ \ No newline at end of file
diff --git a/src/math/all.h b/src/math/all.h
index 13a9290..4ac9d55 100644
--- a/src/math/all.h
+++ b/src/math/all.h
@@ -14,14 +14,13 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-/** @defgroup MathAllModule math/all.h
- Includes all other math module headers.
+/**
+ * \file math/all.h
+ * \brief Includes all other math module headers
*/
#pragma once
-/* @{ */ // start of group
-
#include "const.h"
#include "func.h"
#include "point.h"
@@ -30,5 +29,3 @@
#include "geometry.h"
#include "conv.h"
-
-/* @} */ // end of group
diff --git a/src/math/const.h b/src/math/const.h
index b08a400..0b6f971 100644
--- a/src/math/const.h
+++ b/src/math/const.h
@@ -14,8 +14,9 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-/** @defgroup MathConstModule math/const.h
- Contains the math constants used in math functions.
+/**
+ * \file math/const.h
+ * \brief Constants used in math functions
*/
#pragma once
@@ -26,7 +27,6 @@
// Math module namespace
namespace Math
{
-/* @{ */ // start of group
//! Tolerance level -- minimum accepted float value
const float TOLERANCE = 1e-6f;
@@ -50,6 +50,5 @@ const float RAD_TO_DEG = 57.29577951308232286465f;
//! Natural logarithm of 2
const float LOG_2 = log(2.0f);
-/* @} */ // end of group
}; // namespace Math
diff --git a/src/math/func.h b/src/math/func.h
index e97d990..541b084 100644
--- a/src/math/func.h
+++ b/src/math/func.h
@@ -15,8 +15,9 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-/** @defgroup MathFuncModule math/func.h
- Contains common math functions.
+/**
+ * \file math/func.h
+ * \brief Common math functions
*/
#pragma once
@@ -31,8 +32,6 @@
namespace Math
{
-/* @{ */ // start of group
-
//! Compares \a a and \a b within \a tolerance
inline bool IsEqual(float a, float b, float tolerance = Math::TOLERANCE)
{
@@ -188,11 +187,13 @@ inline float Direction(float a, float g)
//! Managing the dead zone of a joystick.
/**
-\verbatimin: -1 0 1
+\verbatim
+in: -1 0 1
--|-------|----o----|-------|-->
<---->
dead
-out: -1 0 0 1\endverbatim */
+out: -1 0 0 1
+\endverbatim */
inline float Neutral(float value, float dead)
{
if ( fabs(value) <= dead )
@@ -226,7 +227,8 @@ inline float Smooth(float actual, float hope, float time)
//! Bounces any movement
/**
-\verbatimout
+\verbatim
+out
|
1+------o-------o---
| o | o o | | bounce
@@ -235,7 +237,8 @@ inline float Smooth(float actual, float hope, float time)
| o | |
-o------|-------+----> progress
0| | 1
- |<---->|middle\endverbatim */
+ |<---->|middle
+\endverbatim */
inline float Bounce(float progress, float middle = 0.3f, float bounce = 0.4f)
{
if ( progress < middle )
@@ -250,6 +253,4 @@ inline float Bounce(float progress, float middle = 0.3f, float bounce = 0.4f)
}
}
-/* @} */ // end of group
-
}; // namespace Math
diff --git a/src/math/geometry.h b/src/math/geometry.h
index 3a31ad6..1c5f60f 100644
--- a/src/math/geometry.h
+++ b/src/math/geometry.h
@@ -15,9 +15,9 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-/** @defgroup MathGeometryModule math/geometry.h
- Contains math functions related to 3D geometry calculations,
- transformations, etc.
+/**
+ * \file math/geometry.h
+ * \brief Math functions related to 3D geometry calculations, transformations, etc.
*/
#pragma once
@@ -36,9 +36,6 @@
namespace Math
{
-/* @{ */ // start of group
-
-
//! Returns py up on the line \a a - \a b
inline float MidPoint(const Math::Point &a, const Math::Point &b, float px)
{
@@ -566,6 +563,4 @@ inline Math::Vector RotateView(Math::Vector center, float angleH, float angleV,
return eye+center;
}
-/* @} */ // end of group
-
}; // namespace Math
diff --git a/src/math/intpoint.h b/src/math/intpoint.h
index 476e67b..8e13b19 100644
--- a/src/math/intpoint.h
+++ b/src/math/intpoint.h
@@ -14,18 +14,18 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-/** @defgroup MathIntPointModule math/intpoint.h
- Contains the IntPoint struct.
+/**
+ * \file math/intpoint.h
+ * \brief IntPoint struct
*/
#pragma once
namespace Math {
-/* @{ */ // start of group
-
/**
- * \struct IntPoint 2D Point with integer coords
+ * \struct IntPoint
+ * \brief 2D Point with integer coords
*
* Analog of WinAPI's POINT struct.
*/
@@ -39,6 +39,4 @@ struct IntPoint
IntPoint(int aX = 0, int aY = 0) : x(aX), y(aY) {}
};
-/* @} */ // end of group
-
}; // namespace Math
diff --git a/src/math/matrix.h b/src/math/matrix.h
index 45a7d75..30e629a 100644
--- a/src/math/matrix.h
+++ b/src/math/matrix.h
@@ -14,8 +14,9 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-/** @defgroup MathMatrixModule math/matrix.h
- Contains the Matrix struct and related functions.
+/**
+ * \file math/matrix.h
+ * \brief Matrix struct and related functions
*/
#pragma once
@@ -32,8 +33,6 @@
namespace Math
{
-/* @{ */ // start of group
-
/** \struct Matrix math/matrix.h
\brief 4x4 matrix
@@ -42,11 +41,12 @@ namespace Math
The internal representation is a 16-value table in column-major order, thus:
- \verbatim
+\verbatim
m[0 ] m[4 ] m[8 ] m[12]
m[1 ] m[5 ] m[9 ] m[13]
m[2 ] m[6 ] m[10] m[14]
-m[3 ] m[7 ] m[11] m[15] \endverbatim
+m[3 ] m[7 ] m[11] m[15]
+\endverbatim
This representation is native to OpenGL; DirectX requires transposing the matrix.
@@ -405,11 +405,15 @@ inline Math::Matrix MultiplyMatrices(const Math::Matrix &left, const Math::Matri
}
//! Calculates the result of multiplying m * v
-/** The multiplication is performed thus:
-\verbatim [ m.m[0 ] m.m[4 ] m.m[8 ] m.m[12] ] [ v.x ]
+/**
+ The multiplication is performed thus:
+
+\verbatim
+[ m.m[0 ] m.m[4 ] m.m[8 ] m.m[12] ] [ v.x ]
[ m.m[1 ] m.m[5 ] m.m[9 ] m.m[13] ] [ v.y ]
[ m.m[2 ] m.m[6 ] m.m[10] m.m[14] ] * [ v.z ]
-[ m.m[3 ] m.m[7 ] m.m[11] m.m[15] ] [ 1 ] \endverbatim
+[ m.m[3 ] m.m[7 ] m.m[11] m.m[15] ] [ 1 ]
+\endverbatim
The result, a 4x1 vector is then converted to 3x1 by dividing
x,y,z coords by the fourth coord (w). */
@@ -434,6 +438,4 @@ inline Math::Vector MatrixVectorMultiply(const Math::Matrix &m, const Math::Vect
return Math::Vector(x, y, z);
}
-/* @} */ // end of group
-
}; // namespace Math
diff --git a/src/math/point.h b/src/math/point.h
index ea20db9..ecf896f 100644
--- a/src/math/point.h
+++ b/src/math/point.h
@@ -14,8 +14,9 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-/** @defgroup MathPointModule math/point.h
- Contains the Point struct and related functions.
+/**
+ * \file math/point.h
+ * \brief Point struct and related functions
*/
#pragma once
@@ -31,8 +32,6 @@
namespace Math
{
-/* @{ */ // start of group
-
/** \struct Point math/point.h
\brief 2D point
@@ -188,6 +187,4 @@ 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));
}
-/* @} */ // end of group
-
}; // namespace Math
diff --git a/src/math/vector.h b/src/math/vector.h
index 147869f..4378e75 100644
--- a/src/math/vector.h
+++ b/src/math/vector.h
@@ -14,8 +14,9 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-/** @defgroup MathVectorModule math/vector.h
- Contains the Vector struct and related functions.
+/**
+ * \file math/vector.h
+ * \brief Vector struct and related functions
*/
#pragma once
@@ -31,8 +32,6 @@
namespace Math
{
-/* @{ */ // start of group
-
/** \struct Vector math/vector.h
\brief 3D (3x1) vector
@@ -263,6 +262,4 @@ inline float Distance(const Math::Vector &a, const Math::Vector &b)
(a.z-b.z)*(a.z-b.z) );
}
-/* @} */ // end of group
-
}; // namespace Math