// This code is derived from Plugin::RenderTrajectory. std::vector<std::pair<Position<ICRFJ2000Equator>, Position<ICRFJ2000Equator>>> ApplyDynamicFrame( not_null<Body const*> const body, not_null<DynamicFrame<ICRFJ2000Equator, Rendering>*> const dynamic_frame, DiscreteTrajectory<ICRFJ2000Equator>::Iterator const& begin, DiscreteTrajectory<ICRFJ2000Equator>::Iterator const& end) { std::vector<std::pair<Position<ICRFJ2000Equator>, Position<ICRFJ2000Equator>>> result; // Compute the trajectory in the rendering frame. DiscreteTrajectory<Rendering> intermediate_trajectory; for (auto it = begin; it != end; ++it) { intermediate_trajectory.Append( it.time(), dynamic_frame->ToThisFrameAtTime(it.time())(it.degrees_of_freedom())); } // Render the trajectory at current time in |Rendering|. Instant const& current_time = intermediate_trajectory.last().time(); DiscreteTrajectory<Rendering>::Iterator initial_it = intermediate_trajectory.Begin(); DiscreteTrajectory<Rendering>::Iterator const intermediate_end = intermediate_trajectory.End(); auto to_rendering_frame_at_current_time = dynamic_frame->FromThisFrameAtTime(current_time).rigid_transformation(); if (initial_it != intermediate_end) { for (auto final_it = initial_it; ++final_it, final_it != intermediate_end; initial_it = final_it) { result.emplace_back(to_rendering_frame_at_current_time( initial_it.degrees_of_freedom().position()), to_rendering_frame_at_current_time( final_it.degrees_of_freedom().position())); } } return result; }