def test_Ex2_B_and_delta_in_frame_B_to_C_in_frame_E(): # delta vector from B to C, decomposed in B is given: # A custom reference ellipsoid is given (replacing WGS-84): wgs72 = FrameE(name='WGS72') # Position and orientation of B is given 400m above E: n_EB_E = wgs72.Nvector(unit([[1], [2], [3]]), z=-400) frame_B = FrameB(n_EB_E, yaw=10, pitch=20, roll=30, degrees=True) p_BC_B = frame_B.Pvector(np.r_[3000, 2000, 100].reshape((-1, 1))) p_BC_E = p_BC_B.to_ecef_vector() p_EB_E = n_EB_E.to_ecef_vector() p_EC_E = p_EB_E + p_BC_E pointC = p_EC_E.to_geo_point() lat_EC, lon_EC = pointC.latitude_deg, pointC.longitude_deg z_EC = pointC.z # Here we also assume that the user wants output height (= - depth): msg = 'Ex2, Pos C: lat, long = {},{} deg, height = {} m' print(msg.format(lat_EC, lon_EC, -z_EC)) assert_array_almost_equal(lat_EC, 53.32637826) assert_array_almost_equal(lon_EC, 63.46812344) assert_array_almost_equal(z_EC, -406.00719607)
def test_compare_B_frames(self): E = FrameE(name='WGS84') E2 = FrameE(name='WGS72') n_EB_E = E.Nvector(unit([[1], [2], [3]]), z=-400) B = FrameB(n_EB_E, yaw=10, pitch=20, roll=30, degrees=True) self.assertEqual(B, B) self.assertNotEqual(B, E) B2 = FrameB(n_EB_E, yaw=1, pitch=20, roll=30, degrees=True) self.assertNotEqual(B, B2) B3 = FrameB(n_EB_E, yaw=10, pitch=20, roll=30, degrees=True) self.assertEqual(B, B3) n_EC_E = E.Nvector(unit([[1], [2], [2]]), z=-400) B4 = FrameB(n_EC_E, yaw=10, pitch=20, roll=30, degrees=True) self.assertNotEqual(B, B4) n_ED_E = E2.Nvector(unit([[1], [2], [3]]), z=-400) B5 = FrameB(n_ED_E, yaw=10, pitch=20, roll=30, degrees=True) self.assertNotEqual(B, B5)