- def pygame_poly(self, surface):
- return [
- pymunk.pygame_util.to_pygame(v, surface)
- for v in self.vertices
- ]
+ 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----"
+ return True
+ return False