Skip to content

Commit 0e7dfae

Browse files
Correct sidereal rotation period for precession
This matches the behavior of precessing orbits
1 parent dce4e57 commit 0e7dfae

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/celengine/parseobject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ CreateKeplerianOrbit(const AssociativeArray* orbitData,
206206
{
207207
double periodCorrection = 0.0;
208208
if (elements.nodalPeriod != 0.0)
209-
periodCorrection += 1.0 / elements.nodalPeriod;
209+
periodCorrection -= 1.0 / elements.nodalPeriod;
210210
if (elements.apsidalPeriod != 0.0)
211211
periodCorrection += 1.0 / elements.apsidalPeriod;
212212

src/celephem/rotation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ PrecessingRotationModel::getPeriod() const
276276
Eigen::Quaterniond
277277
PrecessingRotationModel::spin(double tjd) const
278278
{
279-
double rotations = (tjd - epoch) / period;
279+
// Correct the sidereal rotation period for precession of the node
280+
double periodCorrection = precessionPeriod != 0.0 ? 1.0 / precessionPeriod : 0.0;
281+
double rotations = (tjd - epoch) / (1.0 / (1.0 / period - periodCorrection));
280282
double wholeRotations = std::floor(rotations);
281283
double remainder = rotations - wholeRotations;
282284

0 commit comments

Comments
 (0)