Skip to content

Commit

Permalink
some review comments
Browse files Browse the repository at this point in the history
eggrobin committed Jul 5, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4bdc14a commit 8b89db8
Showing 3 changed files with 14 additions and 12 deletions.
18 changes: 9 additions & 9 deletions astronomy/orbital_elements_body.hpp
Original file line number Diff line number Diff line change
@@ -333,22 +333,22 @@ OrbitalElements::ToClassicalElements(
Angle const ω = ϖ - Ω;
Angle const M = equinoctial.λ - ϖ;
classical_elements.push_back(
{equinoctial.t,
equinoctial.a,
e,
i,
classical_elements.empty()
{/*.time = */ equinoctial.t,

This comment has been minimized.

Copy link
@pleroy

pleroy Jul 5, 2020

Member

The astronomy project already uses C++20, so remove the comments.

/*.semimajor_axis = */ equinoctial.a,
/*.eccentricity = */ e,
/*.inclination = */ i,
/*.longitude_of_ascending_node = */ classical_elements.empty()
? Mod(Ω, 2 * π * Radian)
: UnwindFrom(classical_elements.back().longitude_of_ascending_node,
Ω),
classical_elements.empty()
/*.argument_of_periapsis = */ classical_elements.empty()
? Mod(ω, 2 * π * Radian)
: UnwindFrom(classical_elements.back().argument_of_periapsis, ω),
classical_elements.empty()
/*.mean_anomaly = */ classical_elements.empty()
? Mod(M, 2 * π * Radian)
: UnwindFrom(classical_elements.back().mean_anomaly, M),
(1 - e) * equinoctial.a,
(1 + e) * equinoctial.a});
/*.periapsis_distance = */ (1 - e) * equinoctial.a,
/*.apoapsis_distance = */ (1 + e) * equinoctial.a});
}
return classical_elements;
}
7 changes: 4 additions & 3 deletions ksp_plugin_adapter/orbit_analyser.cs
Original file line number Diff line number Diff line change
@@ -7,8 +7,7 @@ namespace ksp_plugin_adapter {
// handling easier, thanks to null-coalescing operators.
internal static class Formatters {
// Formats |value| in "N<fractional_digits>" using the Principia culture.
public static string FormatN(this double value,
int fractional_digits) {
public static string FormatN(this double value, int fractional_digits) {
return value.ToString($"N{fractional_digits}", Culture.culture);
}

@@ -34,7 +33,9 @@ public static string FormatInterval(this Interval interval) {
}

// Displays an interval of lengths as midpoint±half-width, in km if the
// half-width is 100 m or more.
// half-width is 100 m or more. The midpoint is given with respect to
// |offset| (for instance, if |interval| is an interval of distances from the
// primary and |offset| is the radius of the primary, altitudes are shown).
public static string FormatLengthInterval(this Interval interval,
double offset = 0) {
double half_width = (interval.max - interval.min) / 2;
1 change: 1 addition & 0 deletions serialization/journal.proto
Original file line number Diff line number Diff line change
@@ -180,6 +180,7 @@ message OrbitalElements {
required Interval mean_argument_of_periapsis = 9;
required Interval mean_periapsis = 10;
required Interval mean_apoapsis = 11;
// Added in Gallai.
required Interval distance = 12;
}

0 comments on commit 8b89db8

Please sign in to comment.