def testIsBehind(self): ''' is_behind - a plane has passed a given point ''' TO_TEST = [((1,0,0), (0,0,0), (2, 0, 0), False), ((1,0,0), (2,0,0), (1, 0, 0), True), ((1,1,0), (2,0,0), (4, 6, 0), False), ((-1,-1,0), (0,0,0), (1, 1, 0), True), ] for vel, pos, tar, res in TO_TEST: vel, pos, tar = [Vector3(*el) for el in (vel, pos, tar)] self.assertEqual(U.is_behind(vel, pos, tar), res)
def check_overshot(self, point): ''' Return True if the plane has overshot (i.e. flown past) the ``point``. ''' return U.is_behind(self.plane.velocity, self.plane.position, point)