-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better semantics for AttachFork #2087
Conversation
physics/discrete_trajectory.hpp
Outdated
// at the newly-inserted point. |fork| must be a non-empty root. | ||
// Changes |fork| to become a fork of this trajectory at the end of this | ||
// trajectory. |fork| must be a non-empty root. It may or may not have a | ||
// point at the same time as the end of this trajectory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify the requirements on fork
that were implicit in using Append
, e.g., it must not have points before the end of the trajectory, etc.
Clarify the behaviour with respect to the possible common point: which one is kept, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -108,19 +108,41 @@ template<typename Frame> | |||
void DiscreteTrajectory<Frame>::AttachFork( | |||
not_null<std::unique_ptr<DiscreteTrajectory<Frame>>> fork) { | |||
CHECK(fork->is_root()); | |||
CHECK(!fork->timeline_.empty()); | |||
CHECK(!Empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks the flight plan.
Principia/ksp_plugin/flight_plan.cpp
Lines 115 to 121 in d682ca4
// Detach the first coast to keep, truncate its beginning, and reattach it | |
// to a new root. | |
std::unique_ptr<DiscreteTrajectory<Barycentric>> new_first_coast = | |
segments_[*first_to_keep]->DetachFork(); | |
new_first_coast->ForgetBefore(time); | |
root_ = make_not_null_unique<DiscreteTrajectory<Barycentric>>(); | |
root_->AttachFork(std::move(new_first_coast)); |
No description provided.