From 3be5697b9957afddfc3bb992a35e35b5f1d6fe37 Mon Sep 17 00:00:00 2001 From: Alan Aguiar Date: Sat, 14 Sep 2013 07:05:13 +0000 Subject: add pointInsideRectangle function --- 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 -- cgit v0.9.1