Index: /trunk/src/lib/Makefile.am
===================================================================
--- /trunk/src/lib/Makefile.am	(revision 6614)
+++ /trunk/src/lib/Makefile.am	(revision 6615)
@@ -43,4 +43,5 @@
                         util/executor/executor.cc \
                         math/vector.cc \
+                        math/vector2D.cc \
                         math/matrix.cc \
                         math/curve.cc
@@ -62,6 +63,7 @@
                         util/executor/executor_specials.h \
                         util/executor/functor_list.h \
+                        math/vector.h \
+                        math/vector2D.h \
                         math/matrix.h \
-                        math/vector.h \
                         math/curve.h
 
Index: /trunk/src/lib/math/vector2D.cc
===================================================================
--- /trunk/src/lib/math/vector2D.cc	(revision 6615)
+++ /trunk/src/lib/math/vector2D.cc	(revision 6615)
@@ -0,0 +1,66 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: Patrick Boenzli : Vector2D::scale()
+                                    Vector2D::abs()
+
+   Benjamin Grauer: port to Vector2D
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MATH
+
+#include "vector2D.h"
+#ifdef DEBUG
+  #include "debug.h"
+#else
+  #include <stdio.h>
+  #define PRINT(x) printf
+#endif
+
+using namespace std;
+
+/////////////
+/* VECTORS */
+/////////////
+/**
+ *  returns the this-vector normalized to length 1.0
+ * @todo there is some error in this function, that i could not resolve. it just does not, what it is supposed to do.
+ */
+Vector2D Vector2D::getNormalized() const
+{
+  float l = this->len();
+  if(unlikely(l == 1.0 || l == 0.0))
+    return *this;
+  else
+    return (*this / l);
+}
+
+/**
+ *  Vector2D is looking in the positive direction on all axes after this
+*/
+Vector2D Vector2D::abs()
+{
+  Vector2D v(fabs(x), fabs(y));
+  return v;
+}
+
+
+
+/**
+ *  Outputs the values of the Vector2D
+ */
+void Vector2D::debug() const
+{
+  PRINT(0)("x: %f; y: %f", x, y);
+  PRINT(0)(" lenght: %f", len());
+  PRINT(0)("\n");
+}
Index: /trunk/src/lib/math/vector2D.h
===================================================================
--- /trunk/src/lib/math/vector2D.h	(revision 6615)
+++ /trunk/src/lib/math/vector2D.h	(revision 6615)
@@ -0,0 +1,101 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Christian Meyer
+   co-programmer: ...
+*/
+
+/*!
+ * @file vector.h
+ * A basic 3D math framework
+ *
+ * Contains classes to handle vectors, lines, rotations and planes
+*/
+
+#ifndef __VECTOR2D_H_
+#define __VECTOR2D_H_
+
+#include <math.h>
+#include "compiler.h"
+
+//! small and performant 2D vector
+typedef float sVec2D[2];
+
+//! 2D Vector2D
+/**
+ *       Class to handle 2D Vector2Ds
+ */
+class Vector2D {
+ public:
+  Vector2D (float x, float y) : x(x), y(y) {}  //!< assignment constructor
+  Vector2D () : x(0), y(0) {}
+
+  /** @param v: the Vecor to compare with this one @returns true, if the Vecors are the same, false otherwise */
+  inline bool operator== (const Vector2D& v) const { return (this->x==v.x && this->y==v.y)?true:false; };
+  /** @param index The index of the "array" @returns the x/y coordinate */
+  inline float operator[] (float index) const { return ( index == 0)? this->x : this->y; }
+  /** @param v The vector to add @returns the addition between two vectors (this + v) */
+  inline Vector2D operator+ (const Vector2D& v) const { return Vector2D(x + v.x, y + v.y); };
+  /** @param v The vector to add @returns the addition between two vectors (this + v) */
+  inline Vector2D operator+ (const sVec2D& v) const { return Vector2D(x + v[0], y + v[1]); };
+  /** @param v The vector to add  @returns the addition between two vectors (this += v) */
+  inline const Vector2D& operator+= (const Vector2D& v) { this->x += v.x; this->y += v.y; return *this; };
+  /** @param v The vector to substract  @returns the substraction between two vectors (this - v) */
+  inline const Vector2D& operator+= (const sVec2D& v) { this->x += v[0]; this->y += v[1]; return *this; };
+  /** @param v The vector to substract  @returns the substraction between two vectors (this - v) */
+  inline Vector2D operator- (const Vector2D& v) const { return Vector2D(x - v.x, y - v.y); }
+  /** @param v The vector to substract  @returns the substraction between two vectors (this - v) */
+  inline Vector2D operator- (const sVec2D& v) const { return Vector2D(x - v[0], y - v[1]); }
+  /** @param v The vector to substract  @returns the substraction between two vectors (this -= v) */
+  inline const Vector2D& operator-= (const Vector2D& v) { this->x -= v.x; this->y -= v.y; return *this; };
+  /** @param v The vector to substract  @returns the substraction between two vectors (this -= v) */
+  inline const Vector2D& operator-= (const sVec2D& v) { this->x -= v[0]; this->y -= v[1]; return *this; };
+  /** @param v the second vector  @returns The dotProduct between two vector (this (dot) v) */
+  inline float operator* (const Vector2D& v) const { return x * v.x + y * v.y; };
+  /** @todo strange */
+  inline const Vector2D& operator*= (const Vector2D& v) { this->x *= v.x; this->y *= v.y; return *this; };
+  /** @param f a factor to multiply the vector with @returns the vector multiplied by f (this * f) */
+  inline Vector2D operator* (float f) const { return Vector2D(x * f, y * f); };
+  /** @param f a factor to multiply the vector with @returns the vector multiplied by f (this *= f) */
+  inline const Vector2D& operator*= (float f) { this->x *= f; this->y *= f; return *this; };
+  /** @param f a factor to divide the vector with @returns the vector divided by f (this / f) */
+  inline Vector2D operator/ (float f) const { return (unlikely(f == 0.0)) ? Vector2D(0,0):Vector2D(this->x / f, this->y / f); };
+  /** @param f a factor to divide the vector with @returns the vector divided by f (this /= f) */
+  inline const Vector2D& operator/= (float f) {if (unlikely(f == 0.0)) {this->x=0;this->y=0;} else {this->x /= f; this->y /= f;} return *this; };
+  /**  copy constructor @todo (i do not know it this is faster) @param v the vector to assign to this vector. @returns the vector v */
+  inline const Vector2D& operator= (const Vector2D& v) { this->x = v.x; this->y = v.y; return *this; };
+  /** copy constructor* @param v the sVec3D to assign to this vector. @returns the vector v */
+  inline const Vector2D& operator= (const sVec2D& v) { this->x = v[0]; this->y = v[1]; }
+  /** @param v: the other vector \return the dot product of the vectors */
+  float dot (const Vector2D& v) const { return x*v.x+y*v.y; };
+  /** scales the this vector with v* @param v the vector to scale this with */
+  void scale(const Vector2D& v) {   x *= v.x;  y *= v.y; };
+  /** @returns the length of the vector */
+  inline float len() const { return sqrt (x*x+y*y); }
+  /** normalizes the vector */
+  inline void normalize() { float l = len(); if( unlikely(l == 0.0))return; this->x=this->x/l; this->y=this->y/l; };
+  Vector2D getNormalized() const;
+  Vector2D abs();
+
+  void debug() const;
+
+ public:
+  float    x;     //!< The x Coordinate of the Vector2D.
+  float    y;     //!< The y Coordinate of the Vector2D.
+};
+
+
+/** an easy way to create a Random Vector2D @param sideLength the length of the Vector2D (x not sqrt(x^2...)) */
+#define VECTOR2D_RAND(sideLength)  (Vector2D((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * sideLength)
+
+
+#endif /* __VECTOR2D_H_ */
+
