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: cbfc1bd32be6
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a56778444f09
Choose a head ref
  • 5 commits
  • 6 files changed
  • 1 contributor

Commits on Jul 15, 2020

  1. Remove degrees_of_freedom

    eggrobin committed Jul 15, 2020
    Copy the full SHA
    ac52988 View commit details
  2. fix the tests

    eggrobin committed Jul 15, 2020
    Copy the full SHA
    bb97614 View commit details
  3. eliminate

    eggrobin committed Jul 15, 2020
    Copy the full SHA
    118b2a7 View commit details
  4. Copy the full SHA
    2b38495 View commit details
  5. Merge pull request #2650 from eggrobin/reference-part-offset

    Reference part offset
    eggrobin authored Jul 15, 2020
    Copy the full SHA
    a567784 View commit details
Showing with 19 additions and 18 deletions.
  1. +0 −4 ksp_plugin/part.cpp
  2. +0 −4 ksp_plugin/part.hpp
  3. +5 −3 ksp_plugin/plugin.cpp
  4. +3 −1 ksp_plugin/vessel.cpp
  5. +4 −1 ksp_plugin_test/part_test.cpp
  6. +7 −5 ksp_plugin_test/pile_up_test.cpp
4 changes: 0 additions & 4 deletions ksp_plugin/part.cpp
Original file line number Diff line number Diff line change
@@ -161,10 +161,6 @@ RigidMotion<RigidPart, Barycentric> const& Part::rigid_motion() const {
return rigid_motion_;
}

DegreesOfFreedom<Barycentric> Part::degrees_of_freedom() const {
return rigid_motion_({RigidPart::origin, RigidPart::unmoving});
}

DiscreteTrajectory<Barycentric>::Iterator Part::history_begin() {
// Make sure that we skip the point of the prehistory.
auto it = history_->Fork();
4 changes: 0 additions & 4 deletions ksp_plugin/part.hpp
Original file line number Diff line number Diff line change
@@ -110,10 +110,6 @@ class Part final {
RigidMotion<RigidPart, Barycentric> const& rigid_motion);
RigidMotion<RigidPart, Barycentric> const& rigid_motion() const;

// A convenience selector.
// TODO(phl): Should probably be eliminated at some point.
DegreesOfFreedom<Barycentric> degrees_of_freedom() const;

// Return iterators to the beginning and end of the history and psychohistory
// of the part, respectively. Either trajectory may be empty, but they are
// not both empty.
8 changes: 5 additions & 3 deletions ksp_plugin/plugin.cpp
Original file line number Diff line number Diff line change
@@ -715,10 +715,12 @@ RigidMotion<Barycentric, World> Plugin::BarycentricToWorld(
main_body_frame.ToThisFrameAtTime(current_time_);
auto const barycentric_to_main_body_rotation =
barycentric_to_main_body_motion.rigid_transformation().linear_map();
Part const& reference_part = *FindOrDie(part_id_to_vessel_, reference_part_id)
->part(reference_part_id);
auto const reference_part_degrees_of_freedom =
barycentric_to_main_body_motion(
FindOrDie(part_id_to_vessel_, reference_part_id)->
part(reference_part_id)->degrees_of_freedom());
barycentric_to_main_body_motion(reference_part.rigid_motion()(
reference_part.MakeRigidToEccentricMotion().Inverse()(
{EccentricPart::origin, EccentricPart::unmoving})));

RigidTransformation<MainBodyCentred, World> const
main_body_to_world_rigid_transformation = [&]() {
4 changes: 3 additions & 1 deletion ksp_plugin/vessel.cpp
Original file line number Diff line number Diff line change
@@ -169,7 +169,9 @@ void Vessel::PrepareHistory(Instant const& t) {
<< " at " << t;
BarycentreCalculator<DegreesOfFreedom<Barycentric>, Mass> calculator;
ForAllParts([&calculator](Part& part) {
calculator.Add(part.degrees_of_freedom(), part.mass());
calculator.Add(
part.rigid_motion()({RigidPart::origin, RigidPart::unmoving}),
part.mass());
});
CHECK(psychohistory_ == nullptr);
history_->SetDownsampling(max_dense_intervals, downsampling_tolerance);
5 changes: 4 additions & 1 deletion ksp_plugin_test/part_test.cpp
Original file line number Diff line number Diff line change
@@ -147,7 +147,10 @@ TEST_F(PartTest, Serialization) {
auto const p = Part::ReadFromMessage(message, /*deletion_callback=*/nullptr);
EXPECT_EQ(part_.inertia_tensor(), p->inertia_tensor());
EXPECT_EQ(part_.intrinsic_force(), p->intrinsic_force());
EXPECT_EQ(part_.degrees_of_freedom(), p->degrees_of_freedom());
EXPECT_EQ(part_.rigid_motion()({RigidPart::origin, RigidPart::unmoving}),
p->rigid_motion()({RigidPart::origin, RigidPart::unmoving}));
EXPECT_EQ(part_.rigid_motion().angular_velocity_of<RigidPart>(),
p->rigid_motion().angular_velocity_of<RigidPart>());

serialization::Part second_message;
p->WriteToMessage(&second_message,
12 changes: 7 additions & 5 deletions ksp_plugin_test/pile_up_test.cpp
Original file line number Diff line number Diff line change
@@ -626,12 +626,13 @@ TEST_F(PileUpTest, MidStepIntrinsicForce) {
&ephemeris,
deletion_callback_.AsStdFunction());
Velocity<Barycentric> const old_velocity =
p1_.degrees_of_freedom().velocity();
p1_.rigid_motion()({RigidPart::origin, RigidPart::unmoving}).velocity();

pile_up.AdvanceTime(astronomy::J2000 + 1.5 * fixed_step);
pile_up.NudgeParts();
EXPECT_THAT(p1_.degrees_of_freedom().velocity(),
AlmostEquals(old_velocity, 2));
EXPECT_THAT(
p1_.rigid_motion()({RigidPart::origin, RigidPart::unmoving}).velocity(),
AlmostEquals(old_velocity, 2));

Vector<Acceleration, Barycentric> const a{{1729 * Metre / Pow<2>(Second),
-168 * Metre / Pow<2>(Second),
@@ -640,8 +641,9 @@ TEST_F(PileUpTest, MidStepIntrinsicForce) {
pile_up.RecomputeFromParts();
pile_up.AdvanceTime(astronomy::J2000 + 2 * fixed_step);
pile_up.NudgeParts();
EXPECT_THAT(p1_.degrees_of_freedom().velocity(),
AlmostEquals(old_velocity + 0.5 * fixed_step * a, 1));
EXPECT_THAT(
p1_.rigid_motion()({RigidPart::origin, RigidPart::unmoving}).velocity(),
AlmostEquals(old_velocity + 0.5 * fixed_step * a, 1));
}

TEST_F(PileUpTest, Serialization) {