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: ffb9db4191ad
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c9858bf98569
Choose a head ref

Commits on Feb 17, 2020

  1. Euler

    eggrobin committed Feb 17, 2020
    Copy the full SHA
    7d767a2 View commit details

Commits on Feb 18, 2020

  1. bogus aspherical inertia

    eggrobin committed Feb 18, 2020
    Copy the full SHA
    275a1dc View commit details

Commits on Feb 20, 2020

  1. Copy the full SHA
    db99087 View commit details

Commits on Feb 21, 2020

  1. After pleroy’s review

    eggrobin committed Feb 21, 2020
    Copy the full SHA
    13067c9 View commit details
  2. \n

    eggrobin committed Feb 21, 2020
    Copy the full SHA
    39fefae View commit details
  3. t

    eggrobin committed Feb 21, 2020
    Copy the full SHA
    1affd10 View commit details
  4. deps

    eggrobin committed Feb 21, 2020
    Copy the full SHA
    3228cd2 View commit details

Commits on Feb 22, 2020

  1. Merge pull request #2475 from eggrobin/euler

    Euler
    pleroy authored Feb 22, 2020
    Copy the full SHA
    8dca142 View commit details
  2. Copy the full SHA
    1850b2e View commit details
  3. Copy the full SHA
    09c9ceb View commit details
  4. Copy the full SHA
    00e952c View commit details
  5. Copy the full SHA
    768645b View commit details
  6. Merge pull request #2477 from pleroy/PileUpSerialization

    Serialization of the new fields of a pile-up
    pleroy authored Feb 22, 2020
    Copy the full SHA
    fab217d View commit details

Commits on Feb 23, 2020

  1. Copy the full SHA
    6223eea View commit details
  2. Copy the full SHA
    feff1d3 View commit details
  3. Copy the full SHA
    1c648e9 View commit details
  4. Unbreak the Euler solver.

    pleroy committed Feb 23, 2020
    Copy the full SHA
    65a7a91 View commit details
  5. Copy the full SHA
    6f03562 View commit details
  6. Merge.

    pleroy committed Feb 23, 2020
    Copy the full SHA
    a6cdfc4 View commit details
  7. Remove a comment.

    pleroy committed Feb 23, 2020
    Copy the full SHA
    714c7a8 View commit details

Commits on Feb 24, 2020

  1. Merge pull request #2481 from pleroy/AngularMomentum

    Angular momentum
    pleroy authored Feb 24, 2020
    Copy the full SHA
    96e7a4d View commit details
  2. Copy the full SHA
    b281ec5 View commit details

Commits on Feb 25, 2020

  1. Merge pull request #2482 from pleroy/soi

    Properly track rotation across a change of SOI
    pleroy authored Feb 25, 2020
    Copy the full SHA
    3589181 View commit details
  2. New part constructor.

    pleroy committed Feb 25, 2020
    Copy the full SHA
    a7d83e5 View commit details
  3. loaded_ bit.

    pleroy committed Feb 25, 2020
    Copy the full SHA
    9bde730 View commit details
  4. Expose PartIsLoaded.

    pleroy committed Feb 25, 2020
    Copy the full SHA
    1690e00 View commit details

Commits on Feb 26, 2020

  1. Copy the full SHA
    160541c View commit details
  2. Format.

    pleroy committed Feb 26, 2020
    Copy the full SHA
    1166c50 View commit details
  3. Copy the full SHA
    c4e0de4 View commit details
  4. Save the loaded_ bit.

    pleroy committed Feb 26, 2020
    Copy the full SHA
    26a6b63 View commit details
  5. Truthfulness.

    pleroy committed Feb 26, 2020
    Copy the full SHA
    076e30f View commit details
  6. Merge pull request #2483 from pleroy/UnloadedPart

    Fix the handling of unloaded parts to prevent vessels exploding on "set orbit"
    pleroy authored Feb 26, 2020
    Copy the full SHA
    bb5029f View commit details

Commits on Mar 14, 2020

  1. Merge.

    pleroy committed Mar 14, 2020
    Copy the full SHA
    d30d474 View commit details
  2. Extension ids.

    pleroy committed Mar 14, 2020
    Copy the full SHA
    3bcfcf2 View commit details

Commits on Mar 16, 2020

  1. Copy the full SHA
    4d47947 View commit details
  2. Cleanup.

    pleroy committed Mar 16, 2020
    Copy the full SHA
    95cb1e1 View commit details

Commits on Mar 17, 2020

  1. Merge pull request #2499 from pleroy/Merge

    Merge frobenioid into master
    pleroy authored Mar 17, 2020
    Copy the full SHA
    c9858bf View commit details
4 changes: 4 additions & 0 deletions Principia.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -86,6 +86,10 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_CHAINED_BINARY_EXPRESSIONS/@EntryValue">WRAP_IF_LONG</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">80</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_PARAMETERS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/ProtobufCodeFormatting/INDENT_SIZE/@EntryValue">2</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/ProtobufCodeFormatting/TAB_WIDTH/@EntryValue">2</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/ProtobufCodeFormatting/USE_INDENT_FROM_VS/@EntryValue">False</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/ProtobufCodeFormatting/WRAP_LIMIT/@EntryValue">80</s:Int64>
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseExplicitType</s:String>
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseVarWhenEvident</s:String>
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseVarWhenEvident</s:String>
4 changes: 3 additions & 1 deletion geometry/r3x3_matrix.hpp
Original file line number Diff line number Diff line change
@@ -37,7 +37,9 @@ class R3x3Matrix final {
R3Element<Scalar> const& row_y,
R3Element<Scalar> const& row_z);

static R3x3Matrix Diagonal(R3Element<Scalar> const& diagonal);
static R3x3Matrix DiagonalMatrix(R3Element<Scalar> const& diagonal);

R3Element<Scalar> Diagonal() const;

Scalar Trace() const;
Cube<Scalar> Determinant() const;
7 changes: 6 additions & 1 deletion geometry/r3x3_matrix_body.hpp
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ R3x3Matrix<Scalar>::R3x3Matrix(R3Element<Scalar> const& row_x,
: rows_({row_x, row_y, row_z}) {}

template<typename Scalar>
R3x3Matrix<Scalar> R3x3Matrix<Scalar>::Diagonal(
R3x3Matrix<Scalar> R3x3Matrix<Scalar>::DiagonalMatrix(
R3Element<Scalar> const& diagonal) {
return {
{diagonal.x, {}, {}},
@@ -39,6 +39,11 @@ R3x3Matrix<Scalar> R3x3Matrix<Scalar>::Diagonal(
};
}

template<typename Scalar>
R3Element<Scalar> R3x3Matrix<Scalar>::Diagonal() const {
return {rows_[X].x, rows_[Y].y, rows_[Z].z};
}

template<typename Scalar>
Scalar R3x3Matrix<Scalar>::Trace() const {
return rows_[X].x + rows_[Y].y + rows_[Z].z;
6 changes: 0 additions & 6 deletions ksp_plugin/interface.cpp
Original file line number Diff line number Diff line change
@@ -1029,12 +1029,6 @@ char const* __cdecl principia__SerializePlugin(
return m.Return(hexadecimal.data.release());
}

void __cdecl principia__SetAngularMomentumConservation(bool const conserve) {
journal::Method<journal::SetAngularMomentumConservation> m({conserve});
ksp_plugin::PileUp::conserve_angular_momentum = conserve;
return m.Return();
}

// Sets the maximum number of seconds which logs may be buffered for.
void __cdecl principia__SetBufferDuration(int const seconds) {
journal::Method<journal::SetBufferDuration> m({seconds});
8 changes: 8 additions & 0 deletions ksp_plugin/interface_part.cpp
Original file line number Diff line number Diff line change
@@ -99,6 +99,14 @@ QPRW __cdecl principia__PartGetActualDegreesOfFreedom(
ToXYZ(part_angular_velocity.coordinates() / (Radian / Second))});
}

bool __cdecl principia__PartIsTruthful(
Plugin const* const plugin,
uint32_t const part_id) {
journal::Method<journal::PartIsTruthful> m({plugin, part_id});
CHECK_NOTNULL(plugin);
return m.Return(plugin->PartIsTruthful(part_id));
}

void __cdecl principia__PartSetApparentRigidMotion(
Plugin* const plugin,
PartId const part_id,
2 changes: 2 additions & 0 deletions ksp_plugin/ksp_plugin.vcxproj
Original file line number Diff line number Diff line change
@@ -68,6 +68,8 @@
<ClCompile Include="..\journal\profiles.cpp" />
<ClCompile Include="..\journal\recorder.cpp" />
<ClCompile Include="..\numerics\cbrt.cpp" />
<ClCompile Include="..\numerics\elliptic_functions.cpp" />
<ClCompile Include="..\numerics\elliptic_integrals.cpp" />
<ClCompile Include="..\physics\protector.cpp" />
<ClCompile Include="celestial.cpp" />
<ClCompile Include="equator_relevance_threshold.cpp" />
6 changes: 6 additions & 0 deletions ksp_plugin/ksp_plugin.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -169,6 +169,12 @@
<ClCompile Include="interface_part.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\numerics\elliptic_functions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\numerics\elliptic_integrals.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\base\flags.cpp">
<Filter>Source Files</Filter>
</ClCompile>
92 changes: 67 additions & 25 deletions ksp_plugin/part.cpp
Original file line number Diff line number Diff line change
@@ -32,25 +32,34 @@ using quantities::si::Kilogram;
using quantities::si::Metre;
using quantities::si::Radian;

Part::Part(
PartId const part_id,
std::string const& name,
Mass const& mass,
InertiaTensor<RigidPart> const& inertia_tensor,
RigidMotion<RigidPart, Barycentric> const& rigid_motion,
std::function<void()> deletion_callback)
: part_id_(part_id),
name_(name),
mass_(mass),
inertia_tensor_(inertia_tensor),
rigid_motion_(rigid_motion),
prehistory_(make_not_null_unique<DiscreteTrajectory<Barycentric>>()),
subset_node_(make_not_null_unique<Subset<Part>::Node>()),
deletion_callback_(std::move(deletion_callback)) {
prehistory_->Append(astronomy::InfinitePast,
{Barycentric::origin, Barycentric::unmoving});
history_ = prehistory_->NewForkAtLast();
}
constexpr Mass untruthful_part_mass = 1 * Kilogram;

Part::Part(PartId const part_id,
std::string const& name,
Mass const& mass,
InertiaTensor<RigidPart> const& inertia_tensor,
RigidMotion<RigidPart, Barycentric> const& rigid_motion,
std::function<void()> deletion_callback)
: Part(part_id,
name,
/*truthful=*/true,
mass,
inertia_tensor,
rigid_motion,
std::move(deletion_callback)) {}

Part::Part(PartId part_id,
std::string const& name,
DegreesOfFreedom<Barycentric> const& degrees_of_freedom,
std::function<void()> deletion_callback)
: Part(part_id,
name,
/*truthful=*/false,
untruthful_part_mass,
MakeWaterSphereInertiaTensor(untruthful_part_mass),
RigidMotion<RigidPart, Barycentric>::MakeNonRotatingMotion(
degrees_of_freedom),
std::move(deletion_callback)) {}

Part::~Part() {
LOG(INFO) << "Destroying part " << ShortDebugString();
@@ -63,6 +72,14 @@ PartId Part::part_id() const {
return part_id_;
}

bool Part::truthful() const {
return truthful_;
}

void Part::make_truthful() {
truthful_ = true;
}

void Part::set_mass(Mass const& mass) {
mass_change_ = mass - mass_;
mass_ = mass;
@@ -210,6 +227,7 @@ void Part::WriteToMessage(not_null<serialization::Part*> const message,
serialization_index_for_pile_up) const {
message->set_part_id(part_id_);
message->set_name(name_);
message->set_truthful(truthful_);
mass_.WriteToMessage(message->mutable_mass());
inertia_tensor_.WriteToMessage(message->mutable_inertia_tensor());
intrinsic_force_.WriteToMessage(message->mutable_intrinsic_force());
@@ -238,33 +256,36 @@ not_null<std::unique_ptr<Part>> Part::ReadFromMessage(
auto const degrees_of_freedom =
DegreesOfFreedom<Barycentric>::ReadFromMessage(
message.degrees_of_freedom());
part = make_not_null_unique<Part>(
part = std::unique_ptr<Part>(new Part(
message.part_id(),
message.name(),
message.truthful(),
Mass::ReadFromMessage(message.mass()),
MakeWaterSphereInertiaTensor(Mass::ReadFromMessage(message.mass())),
RigidMotion<RigidPart, Barycentric>::MakeNonRotatingMotion(
degrees_of_freedom),
std::move(deletion_callback));
std::move(deletion_callback)));
} else if (is_pre_frenet) {
part = make_not_null_unique<Part>(
part = std::unique_ptr<Part>(new Part(
message.part_id(),
message.name(),
message.truthful(),
Mass::ReadFromMessage(message.pre_frenet_inertia_tensor().mass()),
InertiaTensor<RigidPart>::ReadFromMessage(
message.pre_frenet_inertia_tensor().form()),
RigidMotion<RigidPart, Barycentric>::ReadFromMessage(
message.rigid_motion()),
std::move(deletion_callback));
std::move(deletion_callback)));
} else {
part = make_not_null_unique<Part>(
part = std::unique_ptr<Part>(new Part(
message.part_id(),
message.name(),
message.truthful(),
Mass::ReadFromMessage(message.mass()),
InertiaTensor<RigidPart>::ReadFromMessage(message.inertia_tensor()),
RigidMotion<RigidPart, Barycentric>::ReadFromMessage(
message.rigid_motion()),
std::move(deletion_callback));
std::move(deletion_callback)));
}

part->apply_intrinsic_force(
@@ -317,6 +338,27 @@ std::string Part::ShortDebugString() const {
return name_ + " (" + hex_id.data.get() + ")";
}

Part::Part(PartId const part_id,
std::string const& name,
bool const truthful,
Mass const& mass,
InertiaTensor<RigidPart> const& inertia_tensor,
RigidMotion<RigidPart, Barycentric> const& rigid_motion,
std::function<void()> deletion_callback)
: part_id_(part_id),
name_(name),
truthful_(truthful),
mass_(mass),
inertia_tensor_(inertia_tensor),
rigid_motion_(rigid_motion),
prehistory_(make_not_null_unique<DiscreteTrajectory<Barycentric>>()),
subset_node_(make_not_null_unique<Subset<Part>::Node>()),
deletion_callback_(std::move(deletion_callback)) {
prehistory_->Append(astronomy::InfinitePast,
{Barycentric::origin, Barycentric::unmoving});
history_ = prehistory_->NewForkAtLast();
}

InertiaTensor<RigidPart> MakeWaterSphereInertiaTensor(Mass const& mass) {
static constexpr MomentOfInertia zero;
static constexpr Density ρ_of_water = 1000 * Kilogram / Pow<3>(Metre);
19 changes: 19 additions & 0 deletions ksp_plugin/part.hpp
Original file line number Diff line number Diff line change
@@ -43,19 +43,29 @@ using quantities::Torque;
// Represents a KSP part.
class Part final {
public:
// A truthful part.
Part(PartId part_id,
std::string const& name,
Mass const& mass,
InertiaTensor<RigidPart> const& inertia_tensor,
RigidMotion<RigidPart, Barycentric> const& rigid_motion,
std::function<void()> deletion_callback);

// An untruthful part.
Part(PartId part_id,
std::string const& name,
DegreesOfFreedom<Barycentric> const& degrees_of_freedom,
std::function<void()> deletion_callback);

// Calls the deletion callback passed at construction, if any. This part must
// not be piled up.
~Part();

PartId part_id() const;

bool truthful() const;
void make_truthful();

// Sets or returns the mass and inertia tensor. Even though a part is
// massless in the sense that it doesn't exert gravity, it has a mass and an
// inertia used to determine its intrinsic acceleration and rotational
@@ -146,8 +156,17 @@ class Part final {
std::string ShortDebugString() const;

private:
Part(PartId part_id,
std::string const& name,
bool truthful,
Mass const& mass,
InertiaTensor<RigidPart> const& inertia_tensor,
RigidMotion<RigidPart, Barycentric> const& rigid_motion,
std::function<void()> deletion_callback);

PartId const part_id_;
std::string const name_;
bool truthful_;
Mass mass_;
Mass mass_change_;
InertiaTensor<RigidPart> inertia_tensor_;
Loading