}
}
+double Body::DayLength() const noexcept {
+ if (!HasParent()) {
+ return RotationalPeriod();
+ }
+ double year = OrbitalPeriod();
+ double sidereal = RotationalPeriod();
+ double grade = (angular < 0.0 ? -1.0 : 1.0) * (std::abs(axis_tilt.x) > PI * 0.5 ? -1.0 : 1.0);
+ return std::abs((year * sidereal) / ( year + (grade * sidereal)));
+}
+
double Body::SphereOfInfluence() const noexcept {
if (HasParent()) {
return orbit.SemiMajorAxis() * std::pow(Mass() / Parent().Mass(), 2.0 / 5.0);
}
}
for (auto &c : collisions) {
+ c.A().OnCollide(c.B());
+ c.B().OnCollide(c.A());
c.A().GetSituation().Move(c.Normal() * (c.Depth() * -0.5));
c.B().GetSituation().Move(c.Normal() * (c.Depth() * 0.5));
c.A().GetSituation().Accelerate(c.Normal() * -glm::dot(c.Normal(), c.AVel()));
c.B().GetSituation().Accelerate(c.Normal() * -glm::dot(c.Normal(), c.BVel()));
- // TODO: notify participants so they can be annoyed
}
}