/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
***************************************************************************/

#pragma once

#include "glmVector2.h"
#include "glmAngle.h"

namespace glm
{
	/**
	* \brief A 2 dimensions box.
	* 
	* \ingroup geometry2
	* \author Golaem <dev@golaem.com>
	*
	* \param float Manipulated scalar type (\ref double, float...)
	*/

	class GLM_CORE_API Box2 
	{
	public:

		GLM_CLASS_STAT_ID( glm::MemoryStatIds::GolaemShared)

	public:

		float _cosRotation;
		float _sinRotation;

		/**
		* \name Construction/Destruction
		*/
		//@{
		/**
		* \brief Default constructor.
		*
		* The default constructor builds a unit box (size=1,1) without any applied transformation.
		*/
		Box2();
		/**
		* \brief Constructor.
		* \param size The size of the box.
		* \param translation The translation applied to the box (defines the south-east corner of the box when no rotation is applied).
		* \param rotation The rotation applied to the box (default value is 0).
		*/
		Box2(const Vector2& size, const Vector2& translation, Angle rotation = 0.f );
		/**
		* \brief Copy constructor.
		*/
		Box2(const Box2& box);
		/**
		* \brief Assignment operator.
		*/
		Box2& operator=(const Box2& box);
		//@}

		/**
		* \name Size
		* \brief The size of the box.
		*/
		//@{
		const Vector2& getSize() const;
		void setSize(const Vector2& size);
		float getWidth() const;
		void setWidth(float width);
		float getHeight() const;
		void setHeight(float height);
		//@}

		/**
		* \name Translation
		* \brief The translation applied to the box.
		*/
		//@{
		const Vector2& getTranslation() const;
		void setTranslation(const Vector2& translation);
		//@}

		/**
		* \name Rotation
		* \brief The rotation applied to the box.
		*/
		//@{
		Angle getRotation() const;
		void setRotation(Angle rotation);
		//@}

		/**
		* \name Comparisons
		*/
		//@{
		bool operator==(const Box2& box) const;
		bool operator!=(const Box2& box) const;
		//@}

		/**
		* \name Vertices
		*/
		//@{
		Vector2 getVertex(const Quadrant::Value& quadrant) const;
		//@}

		/**
		* \name UV space
		*/
		//@{
		Vector2 getUVector() const;
		Vector2 getVVector() const;
		Vector2 getPositionFromUV(float u, float v) const;
		//@}

	private:
		Vector2 _size;
		Vector2 _translation;
		Angle _rotation;
	};
}

