From: Simon Cross Date: Wed, 7 Sep 2016 21:48:57 +0000 (+0200) Subject: Remove some hacking. X-Git-Tag: tabakrolletjie-v1.0.0~189 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=7cd6ddff3bbbb40689dd88489b1ef63d8dffbf8f;p=tabakrolletjie.git Remove some hacking. --- diff --git a/data/stations/station-alpha.json b/data/stations/station-alpha.json index 259a645..7eadc6e 100644 --- a/data/stations/station-alpha.json +++ b/data/stations/station-alpha.json @@ -33,7 +33,7 @@ "spread": 45.0, "radius_limits": [20, 400], "angle_limits": [90, 180], - "angular_velocity": 10, + "angular_velocity": 5, "intensity": 0.8 }, { diff --git a/tabakrolletjie/rays.py b/tabakrolletjie/rays.py index f893828..e187f3d 100644 --- a/tabakrolletjie/rays.py +++ b/tabakrolletjie/rays.py @@ -98,18 +98,14 @@ class RayPolyManager(object): def polys(self): if self._poly_cache is None: - print "====" self._poly_cache = [ rp.poly(self._body, self._ray_filter) for rp in self._rays if rp.within_limits(*self._angle_limits) ] - print "====" - return self._poly_cache def pygame_polys(self, surface): if self._pygame_poly_cache is None: - print "REGEN ...", self._angle_limits self._pygame_poly_cache = [ [ pymunk.pygame_util.to_pygame(v, surface) @@ -134,19 +130,14 @@ class RayPoly(object): def within_limits(self, start_limit, end_limit): if start_limit is None or end_limit is None: return True - print "----" - print "LIM: ", start_limit, end_limit - print "ANG: ", self.start.angle, self.end.angle - n1 = self.start.normalized() - n2 = self.end.normalized() - s = pymunk.Vec2d(1, 0).rotated(start_limit) - e = pymunk.Vec2d(1, 0).rotated(end_limit) - n1bet = s.dot(e) < s.dot(n1) and s.dot(e) < s.dot(n1) - n2bet = s.dot(e) < e.dot(n2) and s.dot(e) < e.dot(n2) - print "DOTS n1: ", n1.dot(n2), n1.dot(s), n2.dot(s) - print "DOTS n2: ", n1.dot(n2), n1.dot(e), n2.dot(e) - print "BET: ", n1bet, n2bet - if n1bet: - print "TRUE\n----" + + def between(n): + if start_limit < end_limit: + return start_limit <= n <= end_limit + return (start_limit <= n) or (n <= end_limit) + + start_within = between(self.start.angle) + end_within = between(self.end.angle) + if start_within or end_within: return True return False