diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2013-09-14 07:05:13 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2013-09-14 07:05:13 (GMT) |
commit | 3be5697b9957afddfc3bb992a35e35b5f1d6fe37 (patch) | |
tree | be9499e9d534195a03a7333b3d1c2362614ef193 /src | |
parent | 2b10ab3aab7d39403ffde5b886fe576305db431f (diff) |
add pointInsideRectangle function
Diffstat (limited to 'src')
-rw-r--r-- | src/api/Math.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/api/Math.py b/src/api/Math.py index 1c02a11..41d67ae 100644 --- a/src/api/Math.py +++ b/src/api/Math.py @@ -70,4 +70,18 @@ def pointInsidePolygon(x, y, poly): inside = not inside
p1x,p1y = p2x,p2y
- return inside
\ No newline at end of file + return inside
+
+
+def pointInsideRectangle(x, y, rect):
+
+ x1 = rect[0][0]
+ y1 = rect[0][1]
+ x2 = rect[1][0]
+ y2 = rect[1][1]
+
+ if (x > x1) and (x < x2):
+ if (y > y1) and (y < y2):
+ return True
+ return False
+
\ No newline at end of file |