Rectangle.h
Go to the documentation of this file.
00001 #ifndef __Rectangle_H__
00002 #define __Rectangle_H__
00003 
00004 #include "Vector2.h"
00005 
00006 namespace EdgeDetection
00007 {
00008         // Represents an axis-aligned rectangle in two-dimensional space.
00009         class Rectangle
00010         {
00011                 private: Vector2 start;
00012                 private: Vector2 end;
00013         
00014                 public: Vector2 GetLeftTop() { return Vector2(GetLeft(), GetTop()); }
00015                 public: Vector2 GetRightTop() { return Vector2(GetRight(), GetTop()); }
00016                 public: Vector2 GetLeftBottom() { return Vector2(GetLeft(), GetBottom()); }
00017                 public: Vector2 GetRightBottom() { return Vector2(GetRight(), GetBottom()); }
00018                 public: Vector2 GetCenter() { return Vector2(0.5 * (GetLeft() + GetRight()), 0.5 * (GetTop() + GetBottom())); }
00019                 public: double GetLeft() { return start.GetX(); }
00020                 public: double GetRight() { return end.GetX(); }
00021                 public: double GetTop() { return start.GetY(); }
00022                 public: double GetBottom() { return end.GetY(); }
00023                 public: double GetWidth() { return GetRight() - GetLeft(); }
00024                 public: double GetHeight() { return GetBottom() - GetTop(); }
00025                 public: double GetArea() { return GetWidth() * GetHeight(); }
00026 
00027                 public: Rectangle()
00028                 {
00029                         this->start = Vector2();
00030                         this->end = Vector2();
00031                 }
00032                 public: Rectangle(double left, double right, double top, double bottom)
00033                 {
00034                         this->start = Vector2(left, top);
00035                         this->end = Vector2(right, bottom);
00036                 }
00037                 public: ~Rectangle() { }
00038         };
00039 };
00040 
00041 #endif


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