Panagiotis Christopoulos Charitos 14 anni fa
parent
commit
5ef14b332f
21 ha cambiato i file con 154 aggiunte e 93 eliminazioni
  1. 1 1
      CMakeLists.txt
  2. 18 16
      src/cln/CollisionShape.h
  3. 8 3
      src/cln/LineSegment.h
  4. 6 3
      src/cln/Obb.h
  5. 13 5
      src/cln/Plane.h
  6. 10 3
      src/cln/Ray.h
  7. 11 3
      src/cln/Sphere.h
  8. 1 1
      src/core/App.cpp
  9. 2 2
      src/m/Axisang.h
  10. 3 2
      src/m/Euler.h
  11. 11 12
      src/m/Mat3.h
  12. 26 0
      src/m/Mat3.inl.h
  13. 4 1
      src/m/Mat4.h
  14. 9 8
      src/m/Math.cpp
  15. 10 10
      src/m/Math.h
  16. 9 13
      src/m/Math.inl.h
  17. 3 3
      src/m/Quat.h
  18. 4 3
      src/m/Transform.h
  19. 1 0
      src/m/Vec2.h
  20. 1 1
      src/m/Vec3.h
  21. 3 3
      src/m/Vec4.h

+ 1 - 1
CMakeLists.txt

@@ -33,7 +33,7 @@ ENDIF()
 
 IF(CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
 	ADD_DEFINITIONS("-DBOOST_DISABLE_ASSERTS -mtune=core2 -ffast-math")
-ENDIF(CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ENDIF()
 	
 
 ADD_SUBDIRECTORY(src)

+ 18 - 16
src/cln/CollisionShape.h

@@ -5,35 +5,37 @@
 class Plane;
 
 
-/// Collision shape type
-enum CollisionShapeType
-{
-	CST_LINE_SEG,
-	CST_RAY,
-	CST_PLANE,
-	CST_SPHERE,
-	CST_AABB,
-	CST_OBB,
-	CST_NUM
-};
-
+/// @addtogroup Collision
+/// @{
 
 /// Abstract class for collision shapes
 class CollisionShape
 {
 	public:
-		CollisionShapeType getType() const {return type;}
+		/// Collision shape type
+		enum ClassId
+		{
+			CID_LINE_SEG,
+			CID_RAY,
+			CID_PLANE,
+			CID_SPHERE,
+			CID_AABB,
+			CID_OBB
+		};
 
-	public:
-		CollisionShapeType type;
+		CollisionShape(ClassId cid_): cid(cid_) {}
 
-		CollisionShape(CollisionShapeType type_): type(type_) {}
+		ClassId getClassId() const {return cid;}
 
 		/// If the bounding volume intersects with the plane then the func
 		/// returns 0, else it returns the distance. If the distance is < 0
 		/// then the b.v. lies behind the plane and if > 0 then in front of it
 		virtual float testPlane(const Plane&) const = 0;
+
+	private:
+		ClassId cid;
 };
+/// @}
 
 
 #endif

+ 8 - 3
src/cln/LineSegment.h

@@ -6,12 +6,16 @@
 #include "util/Accessors.h"
 
 
+/// @addtogroup Collision
+/// @{
+
+/// Line segment. Line from a point to a point
 class LineSegment: public CollisionShape
 {
 	public:
 		/// @name Constructors
 		/// @{
-		LineSegment(): CollisionShape(CST_LINE_SEG) {}
+		LineSegment(): CollisionShape(CID_LINE_SEG) {}
 		LineSegment(const Vec3& origin, const Vec3& direction);
 		LineSegment(const LineSegment& b);
 		/// @}
@@ -34,17 +38,18 @@ class LineSegment: public CollisionShape
 		Vec3 dir; ///< P1 = origin+dir so dir = P1-origin
 		/// @}
 };
+/// @}
 
 
 inline LineSegment::LineSegment(const Vec3& origin_, const Vec3& direction)
-:	CollisionShape(CST_LINE_SEG),
+:	CollisionShape(CID_LINE_SEG),
 	origin(origin_),
 	dir(direction)
 {}
 
 
 inline LineSegment::LineSegment(const LineSegment& b)
-:	CollisionShape(CST_LINE_SEG),
+:	CollisionShape(CID_LINE_SEG),
 	origin(b.origin),
 	dir(b.dir)
 {}

+ 6 - 3
src/cln/Obb.h

@@ -6,6 +6,8 @@
 #include "util/Accessors.h"
 #include <boost/array.hpp>
 
+/// @addtogroup Collision
+/// @{
 
 /// Object oriented bounding box
 class Obb: public CollisionShape
@@ -13,7 +15,7 @@ class Obb: public CollisionShape
 	public:
 		/// @name Constructors
 		/// @{
-		Obb(): CollisionShape(CST_OBB) {}
+		Obb(): CollisionShape(CID_OBB) {}
 		Obb(const Obb& b);
 		Obb(const Vec3& center, const Mat3& rotation, const Vec3& extends);
 		/// @}
@@ -51,10 +53,11 @@ class Obb: public CollisionShape
 		/// Get extreme points in 3D space
 		void getExtremePoints(boost::array<Vec3, 8>& points) const;
 };
+/// @}
 
 
 inline Obb::Obb(const Obb& b)
-:	CollisionShape(CST_OBB),
+:	CollisionShape(CID_OBB),
 	center(b.center),
 	rotation(b.rotation),
 	extends(b.extends)
@@ -63,7 +66,7 @@ inline Obb::Obb(const Obb& b)
 
 inline Obb::Obb(const Vec3& center_, const Mat3& rotation_,
 	const Vec3& extends_)
-:	CollisionShape(CST_OBB),
+:	CollisionShape(CID_OBB),
 	center(center_),
 	rotation(rotation_),
 	extends(extends_)

+ 13 - 5
src/cln/Plane.h

@@ -6,12 +6,18 @@
 #include "util/Accessors.h"
 
 
+/// @addtogroup Collision
+/// @{
+
 /// Plane collision shape
 class Plane: public CollisionShape
 {
 	public:
+		/// @name Constructors
+		/// @{
+
 		/// Default constructor
-		Plane(): CollisionShape(CST_PLANE) {}
+		Plane(): CollisionShape(CID_PLANE) {}
 
 		/// Copy constructor
 		Plane(const Plane& b);
@@ -24,6 +30,7 @@ class Plane: public CollisionShape
 
 		/// @see setFromPlaneEquation
 		Plane(float a, float b, float c, float d);
+		/// @}
 
 		/// @name Accessors
 		/// @{
@@ -62,31 +69,32 @@ class Plane: public CollisionShape
 		/// Set from plane equation is ax+by+cz+d
 		void setFromPlaneEquation(float a, float b, float c, float d);
 };
+/// @}
 
 
 inline Plane::Plane(const Plane& b)
-:	CollisionShape(CST_PLANE),
+:	CollisionShape(CID_PLANE),
 	normal(b.normal),
 	offset(b.offset)
 {}
 
 
 inline Plane::Plane(const Vec3& normal_, float offset_)
-:	CollisionShape(CST_PLANE),
+:	CollisionShape(CID_PLANE),
 	normal(normal_),
 	offset(offset_)
 {}
 
 
 inline Plane::Plane(const Vec3& p0, const Vec3& p1, const Vec3& p2)
-:	CollisionShape(CST_PLANE)
+:	CollisionShape(CID_PLANE)
 {
 	setFrom3Points(p0, p1, p2);
 }
 
 
 inline Plane::Plane(float a, float b, float c, float d)
-:	CollisionShape(CST_PLANE)
+:	CollisionShape(CID_PLANE)
 {
 	setFromPlaneEquation(a, b, c, d);
 }

+ 10 - 3
src/cln/Ray.h

@@ -8,19 +8,25 @@
 
 class Plane;
 
+/// @addtogroup Collision
+/// @{
 
 /// Ray collision shape. It has a starting point but the end extends to infinity
 class Ray: public CollisionShape
 {
 	public:
+		/// @name Constructors
+		/// @{
+
 		/// Default constructor
-		Ray(): CollisionShape(CST_RAY) {}
+		Ray(): CollisionShape(CID_RAY) {}
 
 		/// Copy constructor
 		Ray(const Ray& other);
 
 		/// Constructor
 		Ray(const Vec3& origin, const Vec3& direction);
+		/// @}
 
 		/// @name Accessors
 		/// @{
@@ -38,17 +44,18 @@ class Ray: public CollisionShape
 		Vec3 origin;
 		Vec3 dir;
 };
+/// @}
 
 
 inline Ray::Ray(const Ray& other)
-:	CollisionShape(CST_RAY),
+:	CollisionShape(CID_RAY),
 	origin(other.origin),
 	dir(other.dir)
 {}
 
 
 inline Ray::Ray(const Vec3& origin_, const Vec3& direction_)
-:	CollisionShape(CST_RAY),
+:	CollisionShape(CID_RAY),
 	origin(origin_),
 	dir(direction_)
 {}

+ 11 - 3
src/cln/Sphere.h

@@ -9,18 +9,25 @@
 class Plane;
 
 
+/// @addtogroup Collision
+/// @{
+
 /// Sphere collision shape
 class Sphere: public CollisionShape
 {
 	public:
+		/// @name Constructors
+		/// @{
+
 		/// Default constructor
-		Sphere(): CollisionShape(CST_SPHERE) {}
+		Sphere(): CollisionShape(CID_SPHERE) {}
 
 		/// Copy constructor
 		Sphere(const Sphere& other);
 
 		/// Constructor
 		Sphere(const Vec3& center_, float radius_);
+		/// @}
 
 		/// @name Accessors
 		/// @{
@@ -45,17 +52,18 @@ class Sphere: public CollisionShape
 		Vec3 center;
 		float radius;
 };
+/// @}
 
 
 inline Sphere::Sphere(const Sphere& b)
-:	CollisionShape(CST_SPHERE),
+:	CollisionShape(CID_SPHERE),
 	center(b.center),
 	radius(b.radius)
 {}
 
 
 inline Sphere::Sphere(const Vec3& center_, float radius_)
-:	CollisionShape(CST_SPHERE),
+:	CollisionShape(CID_SPHERE),
 	center(center_),
 	radius(radius_)
 {}

+ 1 - 1
src/core/App.cpp

@@ -89,7 +89,7 @@ void App::init(int argc, char* argv[])
 
 	// other
 	activeCam = NULL;
-	timerTick = 1.0 / 40.0; // in sec. 1.0 / period
+	timerTick = 1.0 / 60.0; // in sec. 1.0 / period
 }
 
 

+ 2 - 2
src/m/Axisang.h

@@ -8,7 +8,7 @@
 /// @addtogroup Math
 /// @{
 
-/// Used for rotations
+/// Axis angles. Used for rotations
 class Axisang
 {
 	public:
@@ -32,7 +32,7 @@ class Axisang
 		void setAxis(const Vec3& a);
 		/// @}
 		
-		/// @name Operators with same
+		/// @name Operators with same type
 		/// @{
 		Axisang& operator=(const Axisang& b);
 		/// @}

+ 3 - 2
src/m/Euler.h

@@ -7,7 +7,8 @@
 /// @addtogroup Math
 ///
 
-/// Used for rotations. It cannot describe a rotation accurately though
+/// Euler angles. Used for rotations. It cannot describe a rotation
+/// accurately though
 class Euler
 {
 	public:
@@ -32,7 +33,7 @@ class Euler
 		float z() const;
 		/// @}
 
-		/// @name Operators with same
+		/// @name Operators with same type
 		/// @{
 		Euler& operator=(const Euler& b);
 		/// @}

+ 11 - 12
src/m/Mat3.h

@@ -7,8 +7,8 @@
 /// @addtogroup Math
 /// @{
 
-/// Mainly used for rotations. It includes many helpful member functions.
-/// Its row major
+/// 3x3 Matrix. Mainly used for rotations. It includes many helpful member
+/// functions. Its row major
 class Mat3
 {
 	public:
@@ -34,7 +34,7 @@ class Mat3
 		const float& operator[](const size_t i) const;
 		/// @}
 
-		/// @name Operators with same
+		/// @name Operators with same type
 		/// @{
 		Mat3& operator=(const Mat3& b);
 		Mat3 operator+(const Mat3& b) const;
@@ -76,24 +76,23 @@ class Mat3
 		void setColumn(const size_t i, const Vec3& v);
 		void getColumns(Vec3& a, Vec3& b, Vec3& c) const;
 		Vec3 getColumn(const size_t i) const;
-		Vec3 getXAxis() const;
-		Vec3 getYAxis() const;
-		Vec3 getZAxis() const;
-		void setXAxis(const Vec3& v3);
-		void setYAxis(const Vec3& v3);
-		void setZAxis(const Vec3& v3);
+		Vec3 getXAxis() const; ///< Get 1st column
+		Vec3 getYAxis() const; ///< Get 2nd column
+		Vec3 getZAxis() const; ///< Get 3rd column
+		void setXAxis(const Vec3& v3); ///< Set 1st column
+		void setYAxis(const Vec3& v3); ///< Set 2nd column
+		void setZAxis(const Vec3& v3); ///< Set 3rd column
 		void setRotationX(const float rad);
 		void setRotationY(const float rad);
 		void setRotationZ(const float rad);
 		/// It rotates "this" in the axis defined by the rotation AND not the
 		/// world axis
 		void rotateXAxis(const float rad);
-		void rotateYAxis(const float rad);
-		void rotateZAxis(const float rad);
+		void rotateYAxis(const float rad); ///< @copybrief rotateXAxis
+		void rotateZAxis(const float rad); ///< @copybrief rotateXAxis
 		void transpose();
 		Mat3 getTransposed() const;
 		void reorthogonalize();
-		void print() const;
 		float getDet() const;
 		void invert();
 		Mat3 getInverse() const;

+ 26 - 0
src/m/Mat3.inl.h

@@ -415,6 +415,7 @@ inline void Mat3::setRows(const Vec3& a, const Vec3& b, const Vec3& c)
 	(*this)(2, 2) = c.z();
 }
 
+
 // setColumns
 inline void Mat3::setColumns(const Vec3& a, const Vec3& b, const Vec3& c)
 {
@@ -429,6 +430,7 @@ inline void Mat3::setColumns(const Vec3& a, const Vec3& b, const Vec3& c)
 	(*this)(2, 2) = c.z();
 }
 
+
 // getRows
 inline void Mat3::getRows(Vec3& a, Vec3& b, Vec3& c) const
 {
@@ -443,6 +445,7 @@ inline void Mat3::getRows(Vec3& a, Vec3& b, Vec3& c) const
 	c.z() = (*this)(2, 2);
 }
 
+
 // getColumns
 inline void Mat3::getColumns(Vec3& a, Vec3& b, Vec3& c) const
 {
@@ -457,6 +460,7 @@ inline void Mat3::getColumns(Vec3& a, Vec3& b, Vec3& c) const
 	c.z() = (*this)(2, 2);
 }
 
+
 // setRow
 inline void Mat3::setRow(const size_t i, const Vec3& v)
 {
@@ -471,6 +475,7 @@ inline Vec3 Mat3::getRow(const size_t i) const
 	return Vec3((*this)(i, 0), (*this)(i, 1), (*this)(i, 2));
 }
 
+
 // setColumn
 inline void Mat3::setColumn(const size_t i, const Vec3& v)
 {
@@ -479,48 +484,56 @@ inline void Mat3::setColumn(const size_t i, const Vec3& v)
 	(*this)(2, i) = v.z();
 }
 
+
 // getColumn
 inline Vec3 Mat3::getColumn(const size_t i) const
 {
 	return Vec3((*this)(0,i), (*this)(1,i), (*this)(2,i));
 }
 
+
 // getXAxis
 inline Vec3 Mat3::getXAxis() const
 {
 	return getColumn(0);
 }
 
+
 // getYAxis
 inline Vec3 Mat3::getYAxis() const
 {
 	return getColumn(1);
 }
 
+
 // getZAxis
 inline Vec3 Mat3::getZAxis() const
 {
 	return getColumn(2);
 }
 
+
 // setXAxis
 inline void Mat3::setXAxis(const Vec3& v3)
 {
 	setColumn(0, v3);
 }
 
+
 // setYAxis
 inline void Mat3::setYAxis(const Vec3& v3)
 {
 	setColumn(1, v3);
 }
 
+
 // setZAxis
 inline void Mat3::setZAxis(const Vec3& v3)
 {
 	setColumn(2, v3);
 }
 
+
 // setRotationX
 inline void Mat3::setRotationX(const float rad)
 {
@@ -538,6 +551,7 @@ inline void Mat3::setRotationX(const float rad)
 	(*this)(2, 2) = costheta;
 }
 
+
 // setRotationY
 inline void Mat3::setRotationY(const float rad)
 {
@@ -555,6 +569,7 @@ inline void Mat3::setRotationY(const float rad)
 	(*this)(2, 2) = costheta;
 }
 
+
 // loadRotationZ
 inline void Mat3::setRotationZ(const float rad)
 {
@@ -572,6 +587,7 @@ inline void Mat3::setRotationZ(const float rad)
 	(*this)(2, 2) = 1.0;
 }
 
+
 // rotateXAxis
 /*
  * the slow code is in comments and above the comments the optimized one
@@ -620,6 +636,7 @@ inline void Mat3::rotateXAxis(const float rad)
 
 }
 
+
 // rotateYAxis
 inline void Mat3::rotateYAxis(const float rad)
 {
@@ -699,6 +716,7 @@ inline void Mat3::rotateZAxis(const float rad)
 	//setColumns(xAxis, yAxis, zAxis);
 }
 
+
 // transpose
 inline void Mat3::transpose()
 {
@@ -713,6 +731,7 @@ inline void Mat3::transpose()
 	(*this)(2, 1) = temp;
 }
 
+
 // transposed
 inline Mat3 Mat3::getTransposed() const
 {
@@ -729,6 +748,7 @@ inline Mat3 Mat3::getTransposed() const
 	return m3;
 }
 
+
 // reorthogonalize
 inline void Mat3::reorthogonalize()
 {
@@ -755,6 +775,7 @@ inline void Mat3::reorthogonalize()
 	setColumns(xAxis, yAxis, zAxis);
 }
 
+
 // Determinant
 inline float Mat3::getDet() const
 {
@@ -770,6 +791,7 @@ inline float Mat3::getDet() const
 		((*this)(0, 1) * (*this)(2, 1) - (*this)(1, 1) * (*this)(2, 0));
 }
 
+
 // getInverse
 // using Gramer's method (Inv(A) = (1/getDet(A)) * Adj(A))
 inline Mat3 Mat3::getInverse() const
@@ -812,12 +834,14 @@ inline Mat3 Mat3::getInverse() const
 	return r;
 }
 
+
 // setIdentity
 inline void Mat3::setIdentity()
 {
 	(*this) = getIdentity();
 }
 
+
 // invert
 // see above
 inline void Mat3::invert()
@@ -825,6 +849,7 @@ inline void Mat3::invert()
 	(*this) = getInverse();
 }
 
+
 // getZero
 inline const Mat3& Mat3::getZero()
 {
@@ -832,6 +857,7 @@ inline const Mat3& Mat3::getZero()
 	return zero;
 }
 
+
 // getIdentity
 inline const Mat3& Mat3::getIdentity()
 {

+ 4 - 1
src/m/Mat4.h

@@ -7,7 +7,8 @@
 /// @addtogroup Math
 /// @{
 
-/// Used mainly for transformations but not necessarily. Its row major
+/// 4x4 Matrix. Used mainly for transformations but not necessarily. Its
+/// row major. SSE optimized
 class Mat4
 {
 	public:
@@ -93,6 +94,8 @@ class Mat4
 		float getDet() const;
 		Mat4 getInverse() const; ///< Invert using Cramer's rule
 		void invert(); ///< See getInverse
+		/// If we suppose this matrix represents a transformation, return the
+		/// inverted transformation
 		Mat4 getInverseTransformation() const;
 		Mat4 lerp(const Mat4& b, float t) const;
 		void setIdentity();

+ 9 - 8
src/m/Math.cpp

@@ -12,7 +12,7 @@ const float Math::EPSILON = 1.0e-6;
 //==============================================================================
 // polynomialSinQuadrant                                                       =
 //==============================================================================
-float Math::polynomialSinQuadrant(float a)
+float Math::polynomialSinQuadrant(const float a)
 {
 	return a * (1.0 + a * a * (-0.16666 + a * a *
 		(0.0083143 - a * a * 0.00018542)));
@@ -22,24 +22,25 @@ float Math::polynomialSinQuadrant(float a)
 //==============================================================================
 // sinCos                                                                      =
 //==============================================================================
-void Math::sinCos(float a, float& sina, float& cosa)
+void Math::sinCos(const float a_, float& sina, float& cosa)
 {
 	bool negative = false;
+	float a = a_;
 	if(a < 0.0)
 	{
 		a = -a;
 		negative = true;
 	}
-	const float kTwoOverPi = 1.0 / (Math::PI / 2.0);
-	float floatA = kTwoOverPi * a;
+	const float TWO_OVER_PI = 1.0 / (PI / 2.0);
+	float floatA = TWO_OVER_PI * a;
 	int intA = (int)floatA;
 
-	const float k_rational_half_pi = 201 / 128.0;
-	const float kRemainderHalfPi = 4.8382679e-4;
+	const float RATIONAL_HALF_PI = 201 / 128.0;
+	const float REMAINDER_HALF_PI = 4.8382679e-4;
 
-	floatA = (a - k_rational_half_pi * intA) - kRemainderHalfPi * intA;
+	floatA = (a - RATIONAL_HALF_PI * intA) - REMAINDER_HALF_PI * intA;
 
-	float floatAMinusHalfPi = (floatA - k_rational_half_pi) - kRemainderHalfPi;
+	float floatAMinusHalfPi = (floatA - RATIONAL_HALF_PI) - REMAINDER_HALF_PI;
 
 	switch(intA & 3)
 	{

+ 10 - 10
src/m/Math.h

@@ -15,30 +15,30 @@ class Math
 		static const float EPSILON;
 
 		/// A fast func that given the angle in rads it returns the sin and cos
-		static void sinCos(float rad, float& sin_, float& cos_);
+		static void sinCos(const float rad, float& sin_, float& cos_);
 
 		/// Optimized square root
-		static float sqrt(float f);
+		static float sqrt(const float f);
 
 		/// Convert
-		static float toRad(float degrees);
+		static float toRad(const float degrees);
 
 		/// Convert
-		static float toDegrees(float rad);
+		static float toDegrees(const float rad);
 
 		/// Optimized sine
-		static float sin(float rad);
+		static float sin(const float rad);
 
 		/// Optimized cosine
-		static float cos(float rad);
+		static float cos(const float rad);
 
 		/// The proper way to test if a float is zero
-		static bool isZero(float f);
+		static bool isZero(const float f);
 
 		/// Mat4(t0,r0,s0) * Mat4(t1, r1, s1) == Mat4(tf, rf, sf)
 		static void combineTransformations(
-			const Vec3& t0, const Mat3& r0, float s0, // in 0
-			const Vec3& t1, const Mat3& r1, float s1, // in 1
+			const Vec3& t0, const Mat3& r0, const float s0, // in 0
+			const Vec3& t1, const Mat3& r1, const float s1, // in 1
 			Vec3& tf, Mat3& rf, float& sf); // out
 
 		/// Mat4(t0, r0, 1.0) * Mat4(t1, r1, 1.0) == Mat4(tf, rf, sf)
@@ -48,7 +48,7 @@ class Math
 			Vec3& tf, Mat3& rf); // out
 
 	private:
-		static float polynomialSinQuadrant(float a);
+		static float polynomialSinQuadrant(const float a);
 };
 /// @}
 

+ 9 - 13
src/m/Math.inl.h

@@ -1,11 +1,7 @@
 #include "MathCommonSrc.h"
-#include <cmath>
 
 
-//==============================================================================
-// Small funcs                                                                 =
-//==============================================================================
-inline float Math::sqrt(float f)
+inline float Math::sqrt(const float f)
 {
 #if defined(MATH_INTEL_SIMD)
 	__m128 mm = _mm_set_ss(f);
@@ -19,39 +15,39 @@ inline float Math::sqrt(float f)
 }
 
 
-inline float Math::toRad(float degrees)
+inline float Math::toRad(const float degrees)
 {
 	return degrees * (Math::PI / 180.0);
 }
 
 
-inline float Math::toDegrees(float rad)
+inline float Math::toDegrees(const float rad)
 {
 	return rad * (180.0 / Math::PI);
 }
 
 
-inline float Math::sin(float rad)
+inline float Math::sin(const float rad)
 {
 	return ::sin(rad);
 }
 
 
-inline float Math::cos(float rad)
+inline float Math::cos(const float rad)
 {
 	return ::cos(rad);
 }
 
 
-inline bool Math::isZero(float f)
+inline bool Math::isZero(const float f)
 {
-	return fabs(f) < Math::EPSILON;
+	return fabs(f) < EPSILON;
 }
 
 
 inline void Math::combineTransformations(
-	const Vec3& t0, const Mat3& r0, float s0,
-	const Vec3& t1, const Mat3& r1, float s1,
+	const Vec3& t0, const Mat3& r0, const float s0,
+	const Vec3& t1, const Mat3& r1, const float s1,
 	Vec3& tf, Mat3& rf, float& sf)
 {
 	tf = t1.getTransformed(t0, r0, s0);

+ 3 - 3
src/m/Quat.h

@@ -7,7 +7,7 @@
 /// @addtogroup Math
 /// @{
 
-/// Used in rotations
+/// Quaternion. Used in rotations
 class Quat
 {
 	public:
@@ -38,7 +38,7 @@ class Quat
 		float& w();
 		/// @}
 
-		/// Operators with same
+		/// Operators with same type
 		/// @{
 		Quat& operator=(const Quat& b);
 		Quat operator*(const Quat& b) const; ///< 16 muls, 12 adds
@@ -50,7 +50,7 @@ class Quat
 		/// @name Other
 		/// @{
 
-		/// Calculates a quat from v0 to v1
+		/// Calculates the rotation from Vec3 v0 to v1
 		void  setFrom2Vec3(const Vec3& v0, const Vec3& v1);
 		float getLength() const;
 		Quat  getInverted() const;

+ 4 - 3
src/m/Transform.h

@@ -9,7 +9,7 @@
 /// @addtogroup Math
 /// @{
 
-/// For transformations
+/// Transformation
 class Transform
 {
 	public:
@@ -37,7 +37,7 @@ class Transform
 		void setScale(const float s);
 		/// @}
 
-		/// @name Operators with same
+		/// @name Operators with same type
 		/// @{
 		Transform& operator=(const Transform& b);
 		/// @}
@@ -47,7 +47,7 @@ class Transform
 		void setIdentity();
 		static const Transform& getIdentity();
 		static Transform combineTransformations(const Transform& a,
-			const Transform& b); ///< @see m::combineTransformations
+			const Transform& b); ///< @copybrief Math::combineTransformations
 		/// @}
 		
 	private:
@@ -58,6 +58,7 @@ class Transform
 		float scale; ///< The uniform scaling
 		/// @}
 };
+/// @}
 
 
 #include "Transform.inl.h"

+ 1 - 0
src/m/Vec2.h

@@ -90,6 +90,7 @@ class Vec2
 		};
 		/// @}
 };
+/// @}
 
 
 #include "Vec2.inl.h"

+ 1 - 1
src/m/Vec3.h

@@ -86,7 +86,7 @@ class Vec3
 
 		/// @name Transformations
 		/// The faster way is by far the Mat4 * Vec3 or the
-		/// getTransformed(Vec3, Mat3)
+		/// getTransformed(const Vec3&, const Mat3&)
 		/// @{
 		Vec3 getTransformed(const Vec3& translate, const Mat3& rotate,
 			float scale) const;

+ 3 - 3
src/m/Vec4.h

@@ -7,7 +7,7 @@
 /// @addtogroup Math
 /// @{
 
-/// 4D vector
+/// 4D vector. SSE optimized
 class Vec4
 {
 	public:
@@ -45,7 +45,7 @@ class Vec4
 #endif
 		/// @}
 
-		/// @name Operators with same
+		/// @name Operators with same type
 		/// @{
 		Vec4& operator=(const Vec4& b);
 		Vec4 operator+(const Vec4& b) const;
@@ -78,7 +78,7 @@ class Vec4
 		Vec4 operator*(const Mat4& m4) const;
 		/// @}
 
-		/// @name Misc methods
+		/// @name Other
 		/// @{
 		float getLength() const;
 		Vec4 getNormalized() const;