#ifndef _COMMON_VECTOR2D_HPP_
#define _COMMON_VECTOR2D_HPP_
#ifndef _COMMON_POINT_HPP_
#include <common/point.hpp>
#endif
#ifndef _COMMON_EXCEPTION_HPP_
#include <common/except.hpp>
#endif

class Vector2D
{
public:
  enum {VectorPoints=4};
	Vector2D(void);
	Vector2D(const Vector2D &someVector2D);
  Vector2D(const Point &firstPoint,const Point &secondPoint,const Point &thirdPoint,const Point &fourthPoint);
	~Vector2D();
	Vector2D &operator=(const Vector2D &someVector2D);
  WORD operator==(const Vector2D &someVector2D);
  Point &operator[](WORD vectorIndex);
private:
  Point mVector2D[VectorPoints];
};

inline
Vector2D::Vector2D(void)
{
}

inline
Vector2D::Vector2D(const Vector2D &someVector2D)
{
	mVector2D[0]=((Vector2D&)someVector2D)[0];
	mVector2D[1]=((Vector2D&)someVector2D)[1];
	mVector2D[2]=((Vector2D&)someVector2D)[2];
	mVector2D[3]=((Vector2D&)someVector2D)[3];
}

inline
Vector2D::Vector2D(const Point &firstPoint,const Point &secondPoint,const Point &thirdPoint,const Point &fourthPoint)
{
	mVector2D[0]=firstPoint;
	mVector2D[1]=secondPoint;
	mVector2D[2]=thirdPoint;
  mVector2D[3]=fourthPoint;
}

inline
Vector2D::~Vector2D()
{
}

inline
Vector2D &Vector2D::operator=(const Vector2D &someVector2D)
{
	mVector2D[0]=((Vector2D&)someVector2D)[0];
	mVector2D[1]=((Vector2D&)someVector2D)[1];
	mVector2D[2]=((Vector2D&)someVector2D)[2];
	mVector2D[3]=((Vector2D&)someVector2D)[3];
	return *this;
}

inline
WORD Vector2D::operator==(const Vector2D &someVector2D)
{
	return (mVector2D[0]==((Vector2D&)someVector2D)[0]&&
					mVector2D[1]==((Vector2D&)someVector2D)[1]&&
					mVector2D[2]==((Vector2D&)someVector2D)[2]&&
					mVector2D[3]==((Vector2D&)someVector2D)[3]);
}

inline
Point &Vector2D::operator[](WORD vectorIndex)
{
	if(vectorIndex>=VectorPoints)throw(BoundaryError());
  return mVector2D[vectorIndex];
}
#endif