def test_polar_coord_to(): apoint = Point(50, 50) bpoint = Point(87, 78) angle = apoint._angle_with(bpoint) distance = apoint._distance_to(bpoint) assert apoint.polar_coord_of(bpoint)['angle'] == angle assert apoint.polar_coord_of(bpoint)['distance'] == distance
def test_point_angle(): apoint = Point(50, 50) data = [(Point(60, 50), 0), (Point(50, 60), 270), (Point(50, 40), 90), (Point(40, 50), 180)] for pt, angle in data: angle_m = apoint._angle_with(pt) assert abs(angle_m - angle) <= angle * 0.01,\ "failed for {}, {}".format(str(pt), angle)
def test_point_angle(): apoint = Point(50, 50) data = [ (Point(60, 50), 0), (Point(50, 60), 270), (Point(50, 40), 90), (Point(40, 50), 180) ] for pt, angle in data: angle_m = apoint._angle_with(pt) assert abs(angle_m - angle) <= angle * 0.01,\ "failed for {}, {}".format(str(pt), angle)