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: e249b621bd42
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0aca78c84ac9
Choose a head ref
  • 12 commits
  • 1 file changed
  • 1 contributor

Commits on Aug 26, 2021

  1. Add factory files.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    e88c6b1 View commit details
  2. Copy the full SHA
    828a7d1 View commit details
  3. More tests.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    79a67e3 View commit details
  4. Renames.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    60e8884 View commit details
  5. Convert 2 tests.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    874eb81 View commit details
  6. Convert another test.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    af77b61 View commit details
  7. And another one.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    48d1b71 View commit details
  8. And another one.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    67139aa View commit details
  9. One file done.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    9abf770 View commit details
  10. Fix another test.

    pleroy committed Aug 26, 2021
    Copy the full SHA
    c72f052 View commit details
  11. Copy the full SHA
    4b63198 View commit details

Commits on Aug 27, 2021

  1. Merge.

    pleroy committed Aug 27, 2021
    Copy the full SHA
    0aca78c View commit details
Showing with 12 additions and 40 deletions.
  1. +12 −40 physics/discrete_trajectory_test.cpp
52 changes: 12 additions & 40 deletions physics/discrete_trajectory_test.cpp
Original file line number Diff line number Diff line change
@@ -135,39 +135,6 @@ class DiscreteTrajectoryTest : public testing::Test {
return result;
}

DoublePrecision<Instant> AppendCircularTrajectory(
AngularFrequency const& ω,
Length const& r,
Time const& Δt,
Instant const& t1,
Instant const& t2,
DiscreteTrajectory<World>& trajectory) {
return AppendCircularTrajectory(
ω, r, Δt, DoublePrecision<Instant>(t1), t2, trajectory);
}

DoublePrecision<Instant> AppendCircularTrajectory(
AngularFrequency const& ω,
Length const& r,
Time const& Δt,
DoublePrecision<Instant> const& t1,
Instant const& t2,
DiscreteTrajectory<World>& trajectory) {
Speed const v = ω * r / Radian;
auto t = t1;
for (; t.value <= t2; t.Increment(Δt)) {
DegreesOfFreedom<World> const dof = {
World::origin + Displacement<World>{{r * Cos(ω * (t.value - t0_)),
r * Sin(ω * (t.value - t0_)),
0 * Metre}},
Velocity<World>{{-v * Sin(ω * (t.value - t0_)),
v * Cos(ω * (t.value - t0_)),
0 * Metre / Second}}};
trajectory.Append(t.value, dof);
}
return t;
}

Position<World> q1_, q2_, q3_, q4_;
Velocity<World> p1_, p2_, p3_, p4_;
DegreesOfFreedom<World> d1_, d2_, d3_, d4_;
@@ -913,29 +880,34 @@ TEST_F(DiscreteTrajectoryTest, DownsamplingForks) {
Time const Δt = 10 * Milli(Second);
Instant const t1 = t0_;
Instant const t2 = t0_ + 10 * Second;
auto const root_tmax = AppendCircularTrajectory(ω, r, Δt, t1, t2, root);
AppendTrajectory(*NewCircularTrajectory<World>(ω, r, Δt, t1, t2),
/*to=*/root);
auto const root_tmax = root.back().time;

auto fork1 = root.NewForkAtLast();
fork1->SetDownsampling(max_dense_intervals, tolerance);
Instant const t3 = t2 + 10 * Second;
auto const fork1_tmax =
AppendCircularTrajectory(ω, r, Δt, root_tmax, t3, *fork1);
AppendTrajectory(*NewCircularTrajectory<World>(ω, r, Δt, root_tmax + Δt, t3),
/*to=*/*fork1);
auto const fork1_tmax = fork1->back().time;

// A short fork with no downsampling
auto fork2 = fork1->NewForkAtLast();
fork2->SetDownsampling(max_dense_intervals, tolerance);
Instant const t4 = t3 + 300 * Milli(Second);
auto const fork2_tmax =
AppendCircularTrajectory(ω, r, Δt, fork1_tmax, t4, *fork2);
AppendTrajectory(*NewCircularTrajectory<World>(ω, r, Δt, fork1_tmax + Δt, t4),
/*to=*/*fork2);
auto const fork2_tmax = fork2->back().time;

auto fork3 = fork2->NewForkAtLast();
fork3->SetDownsampling(max_dense_intervals, tolerance);
Instant const t5 = t4 + 10 * Second;
AppendCircularTrajectory(ω, r, Δt, fork2_tmax, t5, *fork3);
AppendTrajectory(*NewCircularTrajectory<World>(ω, r, Δt, fork2_tmax + Δt, t5),
/*to=*/*fork3);

// Roughly 55 points per downsampled segments.
EXPECT_THAT(root.Size(), Eq(56));
EXPECT_THAT(fork1->Size(), Eq(root.Size() + 55));
EXPECT_THAT(fork1->Size(), Eq(root.Size() + 54));
EXPECT_THAT(fork2->Size(), Eq(fork1->Size() + 30));
EXPECT_THAT(fork3->Size(), Eq(fork2->Size() + 55));