summaryrefslogtreecommitdiff
path: root/source/modules/asura-utils/Math/Rect.hpp
blob: 45bf1baeba88ebfbdd5377a168582500bdd2e5ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef _ASURA_ENGINE_RECT_H_
#define _ASURA_ENGINE_RECT_H_

namespace AsuraEngine
{
	namespace Math
	{
		
		template<typename T> 
		struct Rect
		{
		public:
			Rect();
			Rect(T x, T y, T w, T h);
			~Rect() {};

			///
			/// x,yǷrectڡ
			///
			bool Contain(T x, T y);

			///
			/// Ƿཻཻľ
			///
			bool Intersect(const Rect& src, Rect& intersection);
			
			///
			///  Ƿཻཻľ
			///
			static bool Intersect(const Rect<T>& src1, const Rect<T>& src2, Rect<T>& intersection);

			void Set(T x, T y, T w, T h);

			T x, y, w, h;
		};
		
#include "Rect.inc"

		// Define the most common types
		typedef Rect<int>          Recti;
		typedef Rect<unsigned int> Rectu;
		typedef Rect<float>        Rectf;
		typedef Rect<long>         Reftl;

	}
}

namespace AEMath = AsuraEngine::Math;

#endif