本文整理汇总了C++中not_null::FromThisFrameAtTime方法的典型用法代码示例。如果您正苦于以下问题:C++ not_null::FromThisFrameAtTime方法的具体用法?C++ not_null::FromThisFrameAtTime怎么用?C++ not_null::FromThisFrameAtTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类not_null
的用法示例。
在下文中一共展示了not_null::FromThisFrameAtTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyDynamicFrame
// 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;
}