#ifndef _AABB_H_
#define _AABB_H_

#include "Vector2.h"

enum eAABBSideQueryResult
{
	eTopSide = 0,
	eBottomSide,
	eLeftSide,
	eRightSide,
	eInsideAABB
};

class AABBf
{
	public:
	AABBf()
	: Left(0), Right(0), Top(0), Bottom(0)
	{
	}

	AABBf(float L, float R, float T, float B)
	: Left(L), Right(R), Top(T), Bottom(B)
	{
	}

	Vector2 GetCentre()
	{
		Vector2 temp;
		temp.x = Left + ((Right - Left)/2);
		temp.y = Bottom + ((Top - Bottom)/2);

		return temp;
	}

	AABBf& operator= (const AABBf &box)
	{
		Left = box.Left; Right = box.Right; Top = box.Top; Bottom = box.Bottom;
		return *this;
	}

	float Left, Right, Top, Bottom;
};

class AABBi
{
public:
	AABBi()
		: Left(0), Right(0), Top(0), Bottom(0)
	{
	}

	AABBi(int L, int R, int T, int B)
	: Left(L), Right(R), Top(T), Bottom(B)
	{
	}

	Vector2i GetCentre()
	{
		Vector2i temp;
		temp.x = Left + ((Right - Left)/2);
		temp.y = Bottom + ((Top - Bottom)/2);

		return temp;
	}

	AABBi& operator= (const AABBi &box)
	{
		Left = box.Left; Right = box.Right; Top = box.Top; Bottom = box.Bottom;
		return *this;
	}

	static bool AABBvsCircleCollisionTest(const AABBi &box, const Vector2i &circlePos, const int &circleRadius, Vector2i &closestPoint);
	static bool AABBvsAABBCollisionTest(const AABBi &boxA, const AABBi &boxB);
	static eAABBSideQueryResult GetSideFromClosestPoint(const AABBi &box, const Vector2i &point, Vector2i* pSidePointA = 0, Vector2i* pSidePointB = 0);

	int Left, Right, Top, Bottom;
};


#endif
