Index: /orxonox/trunk/src/lib/math/vector.cc
===================================================================
--- /orxonox/trunk/src/lib/math/vector.cc	(revision 3813)
+++ /orxonox/trunk/src/lib/math/vector.cc	(revision 3814)
@@ -23,4 +23,5 @@
 #include "vector.h"
 #include "debug.h"
+#include "stdincl.h"
 
 using namespace std;
@@ -31,14 +32,10 @@
    \return the sum of both vectors
 */
+/*
 Vector Vector::operator+ (const Vector& v) const
 {
-  Vector r;
-
-  r.x = x + v.x;
-  r.y = y + v.y;
-  r.z = z + v.z;
-  
-  return r;
-}
+  return Vector(x + v.x, y + v.y, z + v.z);
+}
+*/
 
 /**
@@ -49,11 +46,5 @@
 Vector Vector::operator- (const Vector& v) const
 {
-  Vector r;
-  
-  r.x = x - v.x;
-  r.y = y - v.y;
-  r.z = z - v.z;
-  
-  return r;
+  return Vector(x - v.x, y - v.y, z - v.z);
 }
 
@@ -75,11 +66,5 @@
 Vector Vector::operator* (float f) const
 {  
-  Vector r;
-  
-  r.x = x * f;
-  r.y = y * f;
-  r.z = z * f;
-  
-  return r;
+  return Vector(x * f, y * f, z * f);
 }
 
@@ -91,17 +76,10 @@
 Vector Vector::operator/ (float f) const
 {
-  Vector r;
-  
-  if( f == 0.0)
+  __UNLIKELY_IF( f == 0.0)
   {
     // Prevent divide by zero
     return Vector (0,0,0);
   }
-  
-  r.x = x / f;
-  r.y = y / f;
-  r.z = z / f;
-  
-  return r;
+  return Vector(x / f, y / f, z / f);
 }
 
@@ -123,11 +101,5 @@
 Vector Vector::cross (const Vector& v) const
 {
-  Vector r;
-  
-  r.x = y * v.z - z * v.y;
-  r.y = z * v.x - x * v.z;
-  r.z = x * v.y - y * v.x;
-  
-  return r;
+  return Vector(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x );
 }
   
@@ -139,5 +111,5 @@
   float l = len();
   
-  if( l == 0.0)
+  __UNLIKELY_IF( l == 0.0)
   {
     // Prevent divide by zero
@@ -158,15 +130,14 @@
 {
   float l = len();
-  if(l != 1.0)
+  __UNLIKELY_IF(l != 1.0)
     {
       return this;
     }
-  else if(l == 0.0)
+  else __UNLIKELY_IF(l == 0.0)
     {
       return 0;
     }
-  
-  Vector *normalizedVector = new Vector(x / l, y /l, z / l);
-  return normalizedVector;
+
+  return new Vector(x / l, y /l, z / l);
 }
 
@@ -365,103 +336,103 @@
 Quaternion Quaternion::operator+(const Quaternion& q) const
 {
-	Quaternion r(*this);
-	r.w = r.w + q.w;
-	r.v = r.v + q.v;
-	return r;
-}
-
-/**
-	\brief subtract two Quaternions
-	\param q: another Quaternion
-	\return the difference of both Quaternions
+  Quaternion r(*this);
+  r.w = r.w + q.w;
+  r.v = r.v + q.v;
+  return r;
+}
+
+/**
+   \brief subtract two Quaternions
+   \param q: another Quaternion
+   \return the difference of both Quaternions
 */
 Quaternion Quaternion::operator- (const Quaternion& q) const
 {
-	Quaternion r(*this);
-	r.w = r.w - q.w;
-	r.v = r.v - q.v;
-	return r;
-}
-
-/**
-	\brief rotate a Vector by a Quaternion
-	\param v: the Vector
-	\return a new Vector representing v rotated by the Quaternion
+  Quaternion r(*this);
+  r.w = r.w - q.w;
+  r.v = r.v - q.v;
+  return r;
+}
+
+/**
+   \brief rotate a Vector by a Quaternion
+   \param v: the Vector
+   \return a new Vector representing v rotated by the Quaternion
 */
 Vector Quaternion::apply (Vector& v) const
 {
-	Quaternion q;
-	q.v = v;
-	q.w = 0;
-	q = *this * q * conjugate();
-	return q.v;
-}
-
-/**
-	\brief multiply a Quaternion with a real value
-	\param f: a real value
-	\return a new Quaternion containing the product
+  Quaternion q;
+  q.v = v;
+  q.w = 0;
+  q = *this * q * conjugate();
+  return q.v;
+}
+
+/**
+   \brief multiply a Quaternion with a real value
+   \param f: a real value
+   \return a new Quaternion containing the product
 */
 Quaternion Quaternion::operator*(const float& f) const
 {
-	Quaternion r(*this);
-	r.w = r.w*f;
-	r.v = r.v*f;
-	return r;
-}
-
-/**
-	\brief divide a Quaternion by a real value
-	\param f: a real value
-	\return a new Quaternion containing the quotient
+  Quaternion r(*this);
+  r.w = r.w*f;
+  r.v = r.v*f;
+  return r;
+}
+
+/**
+   \brief divide a Quaternion by a real value
+   \param f: a real value
+   \return a new Quaternion containing the quotient
 */
 Quaternion Quaternion::operator/(const float& f) const
 {
-	if( f == 0) return Quaternion();
-	Quaternion r(*this);
-	r.w = r.w/f;
-	r.v = r.v/f;
-	return r;
-}
-
-/**
-	\brief calculate the conjugate value of the Quaternion
-	\return the conjugate Quaternion
+  if( f == 0) return Quaternion();
+  Quaternion r(*this);
+  r.w = r.w/f;
+  r.v = r.v/f;
+  return r;
+}
+
+/**
+   \brief calculate the conjugate value of the Quaternion
+   \return the conjugate Quaternion
 */
 Quaternion Quaternion::conjugate() const
 {
-	Quaternion r(*this);
-	r.v = Vector() - r.v;
-	return r;
-}
-
-/**
-	\brief calculate the norm of the Quaternion
-	\return the norm of The Quaternion
+  Quaternion r(*this);
+  r.v = Vector() - r.v;
+  return r;
+}
+
+/**
+   \brief calculate the norm of the Quaternion
+   \return the norm of The Quaternion
 */
 float Quaternion::norm() const
 {
-	return w*w + v.x*v.x + v.y*v.y + v.z*v.z;
-}
-
-/**
-	\brief calculate the inverse value of the Quaternion
-	\return the inverse Quaternion
-	
+  return w*w + v.x*v.x + v.y*v.y + v.z*v.z;
+}
+
+/**
+   \brief calculate the inverse value of the Quaternion
+   \return the inverse Quaternion
+   
 	Note that this is equal to conjugate() if the Quaternion's norm is 1
 */
 Quaternion Quaternion::inverse() const
 {
-	float n = norm();
-	if (n != 0)
-	{
-		return conjugate() / norm();
-	}
-	else return Quaternion();
-}
-
-/**
-	\brief convert the Quaternion to a 4x4 rotational glMatrix
-	\param m: a buffer to store the Matrix in
+  float n = norm();
+  if (n != 0)
+    {
+      return conjugate() / norm();
+    }
+  else return Quaternion();
+}
+
+/**
+   \brief convert the Quaternion to a 4x4 rotational glMatrix
+   \param m: a buffer to store the Matrix in
 */
 void Quaternion::matrix (float m[4][4]) const
Index: /orxonox/trunk/src/lib/math/vector.h
===================================================================
--- /orxonox/trunk/src/lib/math/vector.h	(revision 3813)
+++ /orxonox/trunk/src/lib/math/vector.h	(revision 3814)
@@ -29,5 +29,5 @@
   ~Vector () {}
 
-  Vector operator+ (const Vector& v) const;
+  inline Vector operator+ (const Vector& v) const { return Vector(x + v.x, y + v.y, z + v.z); }
   Vector operator- (const Vector& v) const;
   float operator* (const Vector& v) const;
