BoundedLine.h
Go to the documentation of this file.
00001 #ifndef __BoundedLine_H__
00002 #define __BoundedLine_H__
00003 
00004 #include "Line.h"
00005 #include "Vector2.h"
00006 
00007 namespace EdgeDetection
00008 {
00009         // Represents a bounded line in two-dimensional space.
00010         class BoundedLine : public Line
00011         {
00012                 private: Vector2 start;
00013                 private: Vector2 end;
00014 
00015                 public: Vector2 GetStart() { return start; }
00016                 public: Vector2 GetEnd() { return end; }
00017                 public: double GetLength() { return Vector2::Subtract(start, end).GetLength(); }
00018 
00019                 public: BoundedLine()
00020                 {
00021                         this->start = Vector2();
00022                         this->end = Vector2();
00023                 }
00024                 public: BoundedLine(Vector2 start, Vector2 end) : Line(end.GetY() - start.GetY(), start.GetX() - end.GetX(), end.GetX() * start.GetY() - start.GetX() * end.GetY())
00025                 {
00026                         if (Vector2::Equals(start, end)) throw "The parameters 'start' and 'end' cannot be the same.";
00027 
00028                         this->start = start;
00029                         this->end = end;
00030                 }
00031                 public: ~BoundedLine() { }
00032 
00033                 public: Vector2 GetPosition(double fraction)
00034                 {
00035                         if (fraction < 0 || fraction > 1) throw "The parameter 'fraction' was out of range.";
00036 
00037                         return Vector2::Add(start, Vector2::Multiply(fraction, Vector2::Subtract(end, start)));
00038                 }
00039         };
00040 };
00041 
00042 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


aruco_pose
Author(s): Julian Brunner
autogenerated on Thu May 23 2013 12:15:46