Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 551ea145f798
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 90e49e6fcf41
Choose a head ref
  • 10 commits
  • 3 files changed
  • 1 contributor

Commits on Oct 27, 2021

  1. Copy the full SHA
    ce0d285 View commit details
  2. Copy the full SHA
    763749a View commit details
  3. Splicing.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    0ca5bbd View commit details
  4. Serialization.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    59cabe9 View commit details
  5. Deserialization.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    31ad591 View commit details
  6. Copy the full SHA
    dfca187 View commit details
  7. Copy the full SHA
    f1cf6e0 View commit details
  8. Readying.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    37e75e5 View commit details

Commits on Oct 28, 2021

  1. Lint.

    pleroy committed Oct 28, 2021
    Copy the full SHA
    88371fb View commit details
  2. Merge pull request #3173 from pleroy/LeftEndpoints

    Change the representation of the time-to-segment map
    pleroy authored Oct 28, 2021
    Copy the full SHA
    90e49e6 View commit details
Showing with 215 additions and 100 deletions.
  1. +19 −12 physics/discrete_traject0ry.hpp
  2. +191 −87 physics/discrete_traject0ry_body.hpp
  3. +5 −1 serialization/physics.proto
31 changes: 19 additions & 12 deletions physics/discrete_traject0ry.hpp
Original file line number Diff line number Diff line change
@@ -123,26 +123,34 @@ class DiscreteTraject0ry : public Trajectory<Frame> {
using DownsamplingParameters =
internal_discrete_trajectory_types::DownsamplingParameters;
using Segments = internal_discrete_trajectory_types::Segments<Frame>;
using SegmentByLeftEndpoint =
absl::btree_map<Instant, typename Segments::iterator>;

// This constructor leaves the list of segments empty (but allocated) as well
// as the time-to-segment mapping.
explicit DiscreteTraject0ry(uninitialized_t);

typename Segments::iterator FindSegment(Instant const& t);
typename Segments::const_iterator FindSegment(Instant const& t) const;
// Returns an iterator to a segment with extremities t1 and t2 such that
// t ∈ [t1, t2[. For the last segment, t2 is assumed to be +∞. A 1-point
// segment is never returned, unless it is the last one (because its upper
// bound is assumed to be +∞). Returns segment_by_left_endpoint_->end() iff
// the trajectory is empty(). Fails if t is before the first time of the
// trajectory.
typename SegmentByLeftEndpoint::iterator FindSegment(Instant const& t);
typename SegmentByLeftEndpoint::const_iterator
FindSegment(Instant const& t) const;

// Checks if this objects is in a consistent state, and returns an error
// status with a relevant message if it isn't.
absl::Status ValidateConsistency() const;

// Updates the segments self-pointers and the time-to-segment mapping after
// segments have been spliced from |from| to |to|. The iterators indicate the
// segments have been spliced from |from| to |to|. The iterator indicates the
// segments to fix-up.
static void AdjustAfterSplicing(
DiscreteTraject0ry& from,
DiscreteTraject0ry& to,
typename Segments::iterator to_segments_begin,
std::reverse_iterator<typename Segments::iterator> to_segments_rend);
typename Segments::iterator to_segments_begin);

// Reads a pre-Ζήνων downsampling message and return the downsampling
// parameters and the start of the dense timeline. The latter will have to be
@@ -174,13 +182,12 @@ class DiscreteTraject0ry : public Trajectory<Frame> {
// DiscreteTrajectory moves. This field is never null and never empty.
not_null<std::unique_ptr<Segments>> segments_;

// This list is never empty. For an empty trajectory, there is a sentinel
// with time -∞ denoting the single segment of the trajectory. As soon as a
// point is appended to the trajectory, the sentinel is removed and a bona
// fide entry replaces it. To access the segment for time t, use
// |--upper_bound(t)|.
absl::btree_map<Instant,
typename Segments::iterator> segment_by_left_endpoint_;
// Maps time |t| to the last segment that start at time |t|. Does not contain
// entries for empty segments (at the beginning of the trajectory) or for
// 1-point segments that are not the last at their time. Empty iff the entire
// trajectory is empty. Always updated using |insert_or_assign| to override
// any preexisting segment with the same endpoint.
SegmentByLeftEndpoint segment_by_left_endpoint_;
};

} // namespace internal_discrete_traject0ry
Loading