Beispiel #1
0
 def check_radius_and_speed(self, obj, orbit):
     # Compute position from orbital elements
     pos = compute_position(obj, orbit.body.non_rotating_reference_frame)
     # Compute radius from position
     radius = norm(pos) * 1000000
     self.assertClose(radius, orbit.radius, error=1)
     # Compute speed from radius
     speed = math.sqrt(orbit.body.gravitational_parameter * ((2 / radius) - (1 / orbit.semi_major_axis)))
     self.assertClose(speed, orbit.speed, error=1)
Beispiel #2
0
 def check_radius_and_speed(self, obj, orbit):
     # Compute position from orbital elements
     pos = compute_position(obj, orbit.body.non_rotating_reference_frame)
     # Compute radius from position
     radius = norm(pos) * 1000000
     self.assertClose(radius, orbit.radius, error=1)
     # Compute speed from radius
     speed = math.sqrt(orbit.body.gravitational_parameter *
                       ((2 / radius) - (1 / orbit.semi_major_axis)))
     self.assertClose(speed, orbit.speed, error=1)
 def check_object_position(self, obj, ref):
     # Check (0,0,0) position is at object position
     self.assertClose((0,0,0), obj.position(ref))
     # Check norm of object position is same as objects orbital radius
     if obj.orbit is not None:
         p = obj.orbit.body.position(ref)
         self.assertClose(obj.orbit.radius, norm(p), error=10)
     # Check position agrees with that calculated from bodies orbit
     if obj.name in ('Kerbin','Mun','Minmus','Test'):
         ref = obj.orbit.body.reference_frame
         expected_pos = compute_position(obj, ref)
         actual_pos = tuple(x / 1000000 for x in obj.position(ref))
         self.assertClose(expected_pos, actual_pos, error=1)
Beispiel #4
0
 def check_object_position(self, obj, ref):
     # Check (0,0,0) position is at object position
     self.assertClose((0, 0, 0), obj.position(ref))
     # Check norm of object position is same as objects orbital radius
     if obj.orbit is not None:
         p = obj.orbit.body.position(ref)
         self.assertClose(obj.orbit.radius, norm(p), error=10)
     # Check position agrees with that calculated from bodies orbit
     if obj.name in ('Kerbin', 'Mun', 'Minmus', 'Test'):
         ref = obj.orbit.body.reference_frame
         expected_pos = compute_position(obj, ref)
         actual_pos = tuple(x / 1000000 for x in obj.position(ref))
         self.assertClose(expected_pos, actual_pos, error=1)