From 03b3b8ae80559745f98ef94569b421adddeb441f Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Mar 2019 23:46:59 +0800 Subject: *misc --- source/libs/asura-lib-utils/math/rect.hpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source/libs/asura-lib-utils/math/rect.hpp') diff --git a/source/libs/asura-lib-utils/math/rect.hpp b/source/libs/asura-lib-utils/math/rect.hpp index f635007..1751634 100644 --- a/source/libs/asura-lib-utils/math/rect.hpp +++ b/source/libs/asura-lib-utils/math/rect.hpp @@ -13,8 +13,20 @@ namespace AsuraEngine Rect(); ~Rect(T x, T y, T w, T h); - template - explicit Rect(const Rect& rect); + /// + /// x,y是否落在rect内。 + /// + bool Contain(T x, T y); + + /// + /// 两个矩形是否相交,并返回相交的矩形 + /// + bool Intersect(const Rect& src, Rect& intersection); + + /// + /// 两个矩形是否相交,并返回相交的矩形 + /// + static bool Intersect(const Rect& src1, const Rect& src2, Rect& intersection); T x, y, w, h; }; @@ -25,8 +37,11 @@ namespace AsuraEngine typedef Rect Recti; typedef Rect Rectu; typedef Rect Rectf; + typedef Rect Reftl; } } +namespace AEMath = AsuraEngine::Math; + #endif \ No newline at end of file -- cgit v1.1-26-g67d0