Example #1
0
def test_polar_to_cartesian():
    """Test helper transform function from polar to cartesian"""
    r = 1
    theta = np.pi
    # expected values are (-1, 0)
    x = r * np.cos(theta)
    y = r * np.sin(theta)
    coord = _polar_to_cartesian(theta, r)
    # np.pi is an approx since pi is irrational
    assert_almost_equal(coord, (x, y), 10)
    assert_almost_equal(coord, (-1, 0), 10)
Example #2
0
def test_polar_to_cartesian():
    """Test helper transform function from polar to cartesian"""
    r = 1
    theta = np.pi
    # expected values are (-1, 0)
    x = r * np.cos(theta)
    y = r * np.sin(theta)
    coord = _polar_to_cartesian(theta, r)
    # np.pi is an approx since pi is irrational
    assert_almost_equal(coord, (x, y), 10)
    assert_almost_equal(coord, (-1, 0), 10)