From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/math/vector2f.h | 60 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 26 deletions(-) (limited to 'src/math/vector2f.h') diff --git a/src/math/vector2f.h b/src/math/vector2f.h index ba60aa1..1a5f4de 100644 --- a/src/math/vector2f.h +++ b/src/math/vector2f.h @@ -19,96 +19,104 @@ class Vector2f public: /// default constructor Vector2f(); - + /// assignment constructor Vector2f(const float x, const float y); - + /// copy constructor Vector2f(const Vector2f &other); - + /// assign (0,0) void clear(); - + /// assignment operator void assign(const float x, const float y); - + /// assignment operator void assign(const Vector2f &other); - + /// assignment operator Vector2f & operator=(const Vector2f &other); - + /// vector subtraction Vector2f & operator-=(const Vector2f &other); - + /// vector sum Vector2f & operator+=(const Vector2f &other); - + /// vector subtraction inline Vector2f operator+(const Vector2f &other) const { - Vector2f v(coord[0] + other.coord[0], coord[1]+other.coord[1]); + Vector2f v(coord[0] + other.coord[0], coord[1] + other.coord[1]); return v; } - + /// vector sum inline Vector2f operator-(const Vector2f &other) const { Vector2f v(coord[0] - other.coord[0], coord[1] - other.coord[1]); return v; } - + /// scalar product inline Vector2f operator*(const float scalar) const { Vector2f v(coord[0]*scalar, coord[1]*scalar); return v; } - + /// scalar division inline Vector2f operator/(const float scalar) const { - Vector2f v(coord[0]/scalar, coord[1]/scalar); + Vector2f v(coord[0] / scalar, coord[1] / scalar); return v; } - + /// array operator inline float& operator[](const size_t index) { return coord[index]; } - + /// array operator inline float operator[](const size_t index) const { return coord[index]; } - + /// x coordinate inline float width() const { return coord[0]; } - + /// y coordinate inline float height() const { return coord[1]; } /// x coordinate - inline float x() const { return coord[0]; } - + inline float x() const { + return coord[0]; + } + /// y coordinate - inline float y() const { return coord[1]; } + inline float y() const { + return coord[1]; + } /// mutable reference to the x coordinate - inline float & get_x() { return coord[0]; } + inline float & get_x() { + return coord[0]; + } /// mutable reference to the y coordinate - inline float & get_y() { return coord[1]; } - + inline float & get_y() { + return coord[1]; + } + /// a pointer to the internal data inline float *ptr() const { return (float *) coord; } - + inline bool contains(const Vector2f &other) const { return ((other.coord[0] >= 0) && (other.coord[1] >= 0) && (other.coord[0] <= coord[0]) && (other.coord[1] <= coord[1])); } - + inline bool contains(float x, float y) const { return ((x >= 0) && (y >= 0) && (x <= coord[0]) && (y <= coord[1])); } -- cgit v1.2.3