Пример #1
0
// Calls |plugin->CelestialFromParent| with the arguments given.
// |plugin| must not be null.  No transfer of ownership.
QP principia__CelestialFromParent(Plugin const* const plugin,
                                  int const celestial_index) {
  journal::Method<journal::CelestialFromParent> m({plugin, celestial_index});
  CHECK_NOTNULL(plugin);
  RelativeDegreesOfFreedom<AliceSun> const result =
      plugin->CelestialFromParent(celestial_index);
  return m.Return({ToXYZ(result.displacement().coordinates() / Metre),
                   ToXYZ(result.velocity().coordinates() / (Metre / Second))});
}
Пример #2
0
// Calls |plugin->VesselFromParent| with the arguments given.
// |plugin| must not be null.  No transfer of ownership.
QP principia__VesselFromParent(Plugin const* const plugin,
                               char const* const vessel_guid) {
  journal::Method<journal::VesselFromParent> m({plugin, vessel_guid});
  CHECK_NOTNULL(plugin);
  RelativeDegreesOfFreedom<AliceSun> const result =
      plugin->VesselFromParent(vessel_guid);
  return m.Return({ToXYZ(result.displacement().coordinates() / Metre),
                   ToXYZ(result.velocity().coordinates() / (Metre / Second))});
}
Пример #3
0
QP principia__IteratorGetQP(Iterator const* const iterator) {
  journal::Method<journal::IteratorGetQP> m({iterator});
  CHECK_NOTNULL(iterator);
  auto const typed_iterator = check_not_null(
      dynamic_cast<TypedIterator<DiscreteTrajectory<World>> const*>(iterator));
  return m.Return(typed_iterator->Get<QP>(
      [](DiscreteTrajectory<World>::Iterator const& iterator) -> QP {
        DegreesOfFreedom<World> const degrees_of_freedom =
            iterator.degrees_of_freedom();
        return {
            ToXYZ(
                (degrees_of_freedom.position() - World::origin).coordinates() /
                Metre),
            ToXYZ(degrees_of_freedom.velocity().coordinates() /
                  (Metre / Second))};
      }));
}
Пример #4
0
XYZ principia__BubbleVelocityCorrection(Plugin const* const plugin,
                                        int const reference_body_index) {
  journal::Method<journal::BubbleVelocityCorrection> m({plugin,
                                                        reference_body_index});
  CHECK_NOTNULL(plugin);
  Velocity<World> const result =
      plugin->BubbleVelocityCorrection(reference_body_index);
  return m.Return(ToXYZ(result.coordinates() / (Metre / Second)));
}
Пример #5
0
XYZ principia__BubbleDisplacementCorrection(Plugin const* const plugin,
                                            XYZ const sun_position) {
  journal::Method<journal::BubbleDisplacementCorrection> m({plugin,
                                                            sun_position});
  CHECK_NOTNULL(plugin);
  Displacement<World> const result =
      plugin->BubbleDisplacementCorrection(
          World::origin + Displacement<World>(FromXYZ(sun_position) * Metre));
  return m.Return(ToXYZ(result.coordinates() / Metre));
}
Пример #6
0
XYZ principia__IteratorGetXYZ(Iterator const* const iterator) {
  journal::Method<journal::IteratorGetXYZ> m({iterator});
  CHECK_NOTNULL(iterator);
  auto const typed_iterator = check_not_null(
      dynamic_cast<TypedIterator<DiscreteTrajectory<World>> const*>(iterator));
  return m.Return(typed_iterator->Get<XYZ>(
      [](DiscreteTrajectory<World>::Iterator const& iterator) -> XYZ {
        return ToXYZ((iterator.degrees_of_freedom().position() - World::origin)
                         .coordinates() /
                     Metre);
      }));
}