def test_y_deflection(self): # Launch a projectile at 45 degrees at 300 m/s. # It should have a flight time of 43.262894944953523 s # for which the range is 9177.445 m, at which point the # deflection should be 0. deflection = pm.y_deflection(45, 300., 9177.4459168013527) assert_almost_equal(deflection, 0)
def test_parabola_line_intersection_point(self): traj = pm.find_trajectory(3, -0.62, 300.) res = pm.parabola_line_intersection_point(3, -0.62, traj, 300, 0) assert_almost_equal(res[3], -0.6293646114131306) assert_almost_equal(res[2], 0) assert_almost_equal(res[1], pm.y_deflection(traj, 300, 3)) assert_almost_equal(res[0], 3) res = pm.parabola_line_intersection_point(3.1, -0.62, traj, 300, 0.8) assert_(res[0] < 3.1) assert_almost_equal(np.array(res), np.array([3.0988052120901273, -0.033550291159381511, 0.0011947938059390722, -0.6299889176505941]))
def test_parabola_line_intersection_point(self): traj = pm.find_trajectory(3, -0.62, 300.) res = pm.parabola_line_intersection_point(3, -0.62, traj, 300, 0) assert_almost_equal(res[3], -0.6293646114131306) assert_almost_equal(res[2], 0) assert_almost_equal(res[1], pm.y_deflection(traj, 300, 3)) assert_almost_equal(res[0], 3) res = pm.parabola_line_intersection_point(3.1, -0.62, traj, 300, 0.8) assert_(res[0] < 3.1) assert_almost_equal( np.array(res), np.array([ 3.0988052120901273, -0.033550291159381511, 0.0011947938059390722, -0.6299889176505941 ]))