Exemplo n.º 1
0
def test_point_from_polar_not_origin_all_quadrants(x, y):

    radius = math.hypot(x, y)
    radians = math.atan2(y, x)
    degrees = math.degrees(radians)

    p = Point.from_polar(radius, radians)
    q = Point.from_polar(radius, degrees, is_radians=False)

    i = Point()
    i.radius = radius
    i.radians = radians

    j = Point()
    j.radius = radius
    j.degrees = degrees

    assert p.x == x and p.y == y
    assert q.x == x and q.y == y
    assert i.x == x and i.y == y
    assert j.x == x and j.y == y
    assert p == q == i == j
Exemplo n.º 2
0
def test_point_from_polar_origin_radians():
    p = Point.from_polar(0, 0)
    assert p.is_origin
Exemplo n.º 3
0
def test_point_from_polar_translate(to):
    p = Point.from_polar(0, 0, translate=to)
    assert p == to
Exemplo n.º 4
0
def test_point_from_polar_origin_degrees():
    p = Point.from_polar(0, 0, is_radians=False)
    assert p.is_origin