Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
E:/Programming/MyProject/K_Game_hg/GameEngine/include/core/Vector2d.h
Go to the documentation of this file.
00001 // Copyright 2006-2011 by Kat'Oun
00002 
00003 #ifndef _VECTOR_2D_H_
00004 #define _VECTOR_2D_H_
00005 
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 
00009 namespace core
00010 {
00011 
00013 class ENGINE_PUBLIC_EXPORT vector2d
00014 {
00015 public:
00016 
00017         vector2d();
00018         vector2d(f32 nx, f32 ny);
00019         vector2d(const vector2d& other);
00020 
00021         vector2d operator-() const;
00022 
00023         vector2d& operator=(const vector2d& other);
00024 
00025         vector2d operator+(const vector2d& other) const;
00026         vector2d& operator+=(const vector2d& other);
00027 
00028         vector2d operator-(const vector2d& other) const;
00029         vector2d& operator-=(const vector2d& other);
00030 
00031         vector2d operator*(const vector2d& other) const;
00032         vector2d& operator*=(const vector2d& other);
00033         vector2d operator*(const f32 v) const;
00034         vector2d& operator*=(const f32 v);
00035 
00036         vector2d operator/(const vector2d& other) const;
00037         vector2d& operator/=(const vector2d& other);
00038         vector2d operator/(const f32 v) const;
00039         vector2d& operator/=(const f32 v);
00040 
00041         bool operator==(const vector2d& other) const;
00042         bool operator!=(const vector2d& other) const;
00043 
00045         void invert();
00046 
00048         vector2d& normalize();
00049 
00050         void set(const f32& nx, const f32& ny);
00051         void set(const vector2d& other);
00052 
00053         f32* get();
00054         const f32* get() const;
00055 
00057         f32 getLength() const;
00058 
00062         f32 getLengthSQ() const;
00063 
00065         void setLength(f32 newLength);
00066 
00068         f32 dotProduct(const vector2d& other) const;
00069 
00072         f32 getDistanceFrom(const vector2d& other) const;
00073 
00076         f32 getDistanceFromSQ(const vector2d& other) const;
00077 
00079         void rotateBy(f32 degrees, const vector2d& center);
00080 
00084         f32 getAngleTrig() const;
00085 
00088         f32 getAngle() const;
00089 
00092         f32 getAngleWith(const vector2d& b) const;
00093 
00095         static const vector2d ORIGIN_2D;
00096 
00097         f32 X, Y;
00098 };
00099 
00100 } // end namespace core
00101 
00102 #endif

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:04 by Doxygen (1.7.4)