#ifndef BOUNDINGBOX_H
#define BOUNDINGBOX_H

#include "Vector.h"
#include <d3dUtility.h>

namespace cbk
{
	class BoundingBox
	{
	public:
		BoundingBox(const Vector& one, const Vector& two);

		const Vector& getLesser(void) const;
		const Vector& getGreater(void) const;

		/*
		Moves the boundries of the bounding box.
		*/
		BoundingBox& setBoundaries(const Vector& one, const Vector& two);

		/*
		Returns if the vector is inside the bounding box.
		*/
		const bool operator==(const Vector& other) const;

		/*
		Returns if the two bounding boxes occupy the exact same space.
		To check if they intersect, use collides.
		*/
		const bool operator==(const BoundingBox& other) const;
		const bool operator!=(const BoundingBox& other) const;

		BoundingBox operator*(const float& scale) const;
		BoundingBox operator+(const Vector& translation) const;

		/*
		Returns if the two bounding boxes intersect.
		*/
		const bool collides(const BoundingBox& other) const;

		/*
		Returns if the vector is inside the bounding box.
		*/
		const bool collides(const Vector& other) const;

		/*
		Returns if the two bounding boxes intersect.
		The first bounding box is scaled around (0, 0, 0) by tScale,
		and the second bounding box is scaled around the same point by oScale.
		*/
		const bool collides(const BoundingBox& other, const float& tScale, const float& oScale) const;

		/*
		Returns if the vector is inside the bounding box.
		The bounding box is scaled around (0, 0, 0) by scale.
		*/
		const bool collides(const Vector& other, const float& scale) const;

		/*
		Renders out a wireframe bounding box on the specified device.
		This function is only intended for debug usage, and may run slowly.
		*/
		void draw(IDirect3DDevice9* device) const;

		/*
		Returns out the center place of the bounding box.
		*/
		const Vector getCenter(void) const;

	protected:
		void adjust(void);

	private:
		/*The two points on the outside of the bounding box.
		One will always contain the lesser of the two values for each dimention.
		The adjust function should always be called if one and two are changed.*/
		Vector one, two;
	};
}

#endif //BOUNDINGBOX_H