//
//	Copyright © 2005 Nemetschek North America 
//	All Rights Reserved.
//
// Created by Vladislav Stanev

#pragma once

namespace VWFC
{
	namespace Math
	{
		class VWPolygon2D;

		class VWRectangle2D
		{
		public:
			// construction
						VWRectangle2D();
						VWRectangle2D(const VWPoint2D& topleft, const VWPoint2D& botRight);
						VWRectangle2D(const VWPoint2D& topleft, double cx, double cy);
						VWRectangle2D(double left, double right, double top, double bottom);
						VWRectangle2D(const VWRectangle2D& src);
						~VWRectangle2D();

			VWRectangle2D& operator=(const VWRectangle2D& src);

			void		SetRect(const VWPoint2D& topleft, const VWPoint2D& botRight);
			void		SetRect(const VWPoint2D& topleft, double cx, double cy);
			void		SetRect(double left, double right, double top, double bottom);
			VWPoint2D	GetTopLeft() const;
			VWPoint2D	GetBottomRight() const;
			VWPoint2D	GetCenter() const;

			double		GetLeft() const;
			double		GetRight() const;
			double		GetTop() const;
			double		GetBottom() const;

			double		GetWidth() const;
			double		GetHeight() const;

			bool		IsPtInside(double x, double y) const;
			bool		IsPtInside(const VWPoint2D& pt) const;
			bool		Intersect(const VWRectangle2D& rc) const;

			void		Unite(double x, double y);
			void		Unite(const VWPoint2D& pt);
			void		Unite(const VWPolygon2D& poly);
			void		Unite(const VWRectangle2D& rect);

		protected:
			bool			m_bIsEmpty;
			VWPoint2D		m_topLeft;
			VWPoint2D		m_bottomRight;
		};
	}
}