def test_angle_change_from_edge_collision(self): obj = Object(9, 4, 1, 1) obj.handle_edge_collision(0, 8, 0, 8) error = "New angle should equal Pi" new_angle = round(obj.direction_angle, 2) self.assertEqual(new_angle, round(math.pi, 2), error) # Check y - collision obj_b = Object(4, 9, 1, 1) obj_b.direction_angle = (5/4 * math.pi) obj_b.handle_edge_collision(0, 8, 0, 8) objb_angle = round(obj_b.direction_angle, 2) expected_angle = round((3/4)*math.pi, 2) error = "New angle should equal (3pi/4)" self.assertEqual(objb_angle, expected_angle, error)
def test_cone_collision_angle_edge_with_direction(self): obj_a = Object(0, 0, 1, 0) obj_a.direction_angle = (3/4) * math.pi obj_b = Object(-2, 2, 1, 0) collision = obj_a.check_cone_collision(obj_b, 2, math.pi / 12) self.assertTrue(collision)