Example #1
0
 def test_first_quad(self):
     """
     Test rotation of vectors. Used in transformation between frames
     """
     theta = np.deg2rad(45)
     vec = np.array([0, 1])  # y, x order
     out = rotate_2d(vec, theta)
     val = np.sqrt(2) / 2
     np.testing.assert_array_equal(out, np.array([val, val]))
def paef_to_ned_with_wind(x):
    """
    Transform PAE frame distances to NED frame and transform with wind.
    This func is designed to be used in np apply, hence the single arg. The column ordering is very specific!
    :param x: array row with ordering [paef_y (always 0), paef_x, impact_time, theta (rad), wind_vel_x, wind_vel_y]
    :return:
    """
    paef_c = x[0:2]
    t_i = x[2]
    theta = x[3]
    wind_vect = x[4:6]
    return rotate_2d(paef_c, theta) + wind_vect * t_i
Example #3
0
 def test_over_2pi(self):
     theta = np.deg2rad(45) + (2 * np.pi)
     vec = np.array([0, 1])  # y, x order
     out = rotate_2d(vec, theta)
     val = np.sqrt(2) / 2
     np.testing.assert_array_almost_equal(out, np.array([val, val]))
Example #4
0
 def test_negative_theta(self):
     theta = np.deg2rad(-45)
     vec = np.array([-1, 0])  # y, x order
     out = rotate_2d(vec, theta)
     val = np.sqrt(2) / 2
     np.testing.assert_array_almost_equal(out, np.array([-val, val]))