Vector2.h
Go to the documentation of this file.
00001 #ifndef __Vector2_H__
00002 #define __Vector2_H__
00003 
00004 #include <cmath>
00005 
00006 namespace EdgeDetection
00007 {
00008         // Represents a vector in two-dimensional space.
00009         class Vector2
00010         {
00011                 private: double x;
00012                 private: double y;
00013 
00014                 public: double GetX() { return x; }
00015                 public: double GetY() { return y; }
00016                 public: double GetLength() { return sqrt(x * x + y * y); }
00017 
00018                 public: Vector2()
00019                 {
00020                         this->x = 0;
00021                         this->y = 0;
00022                 }
00023                 public: Vector2(double angle)
00024                 {
00025                         this->x = cos(angle);
00026                         this->y = sin(angle);
00027                 }
00028                 public: Vector2(double x, double y)
00029                 {
00030                         this->x = x;
00031                         this->y = y;
00032                 }
00033                 public: ~Vector2() { }
00034         
00035                 public: static Vector2 Add(Vector2 vector1, Vector2 vector2) { return Vector2(vector1.x + vector2.x, vector1.y + vector2.y); }
00036                 public: static Vector2 Subtract(Vector2 vector1, Vector2 vector2) { return Vector2(vector1.x - vector2.x, vector1.y - vector2.y); }
00037                 public: static Vector2 Multiply(Vector2 vector, double factor) { return Vector2(vector.x * factor, vector.y * factor); }
00038                 public: static Vector2 Multiply(double factor, Vector2 vector) { return Vector2(factor * vector.x, factor * vector.y); }
00039                 public: static Vector2 Negate(Vector2 vector) { return Multiply(vector, -1); }
00040                 public: static bool Equals(Vector2 vector1, Vector2 vector2) { return vector1.x == vector2.x && vector1.y == vector2.y; }
00041         };
00042 };
00043 
00044 #endif


aruco_pose
Author(s): Julian Brunner
autogenerated on Mon Oct 6 2014 08:32:34