Example #1
0
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
Example #2
0
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
Example #3
0
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)
Example #4
0
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)