summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpitfireX <timm.weber@me.com>2015-08-12 05:51:36 +0200
committerSpitfireX <timm.weber@me.com>2015-08-12 05:51:36 +0200
commite88225c6a6d7766231ecfaacfd44eb3903a9e914 (patch)
treedaf2f78086d0d462754b5d18d1f7221ed835e0e7
parentb521507024a38cf4c26f454be670281b357816dd (diff)
Some more angle stuff
(possibly incomplete and/or hacky)
-rw-r--r--interval_utils.py13
-rw-r--r--strategy.py14
2 files changed, 22 insertions, 5 deletions
diff --git a/interval_utils.py b/interval_utils.py
index e95445a..0d77f4f 100644
--- a/interval_utils.py
+++ b/interval_utils.py
@@ -49,6 +49,13 @@ def find_largest_angle_interval(intervals):
def get_point_angle(origin, p):
dx = p[0] - origin[0]
dy = p[1] - origin[1]
- rads = atan2(-dy,dx)
- rads %= 2*pi
- return rads
+ return math.atan2(dy,dx)
+
+def check_point_in_interval(origin, p, interval):
+ ang = get_point_angle(origin, p)
+ print(interval)
+ print(canonicalize_angle_interval(interval))
+ if ang > interval[0] and ang < interval[1]:
+ return True
+ else:
+ return False \ No newline at end of file
diff --git a/strategy.py b/strategy.py
index 28aaa60..11926ac 100644
--- a/strategy.py
+++ b/strategy.py
@@ -99,5 +99,15 @@ class Strategy:
# more debugging
gui.draw_line(c.player.center, self.target, self.color)
-
- return self.target
+
+ #test stuff pls ignore
+ interval = [0, 0.5*math.pi]
+ point = (c.player.center[0]+10, c.player.center[1]+200)
+
+ gui.draw_arc(c.player.center, 200, interval, (0,0,0))
+ gui.draw_circle(point, 2, (0,0,0))
+
+ print(math.degrees(get_point_angle(c.player.center, point)))
+ print(check_point_in_interval(c.player.center, point, interval))
+
+ return self.target \ No newline at end of file