0
$\begingroup$

I have an orbiting spacecraft which keplerian elements is known. Also, I have a random-ordered list of true anomalies that represents spacecraft's positions on that orbit.

How to sort this list to get all true anomalies in the order in which it will be followed by spacecraft?

$\endgroup$
4
  • 3
    $\begingroup$ Sort their numerical values in increasing order. $\endgroup$
    – notovny
    Commented Nov 28, 2021 at 10:48
  • $\begingroup$ But after apocenter the values start to decrease $\endgroup$
    – Robotex
    Commented Nov 28, 2021 at 12:28
  • $\begingroup$ True anomaly increases in the direction of travel around the orbit. If you're calculating True Anomaly correctly, on an elliptical orbit, the object will cycle through the list, in ascending order, over and over again. $\endgroup$
    – notovny
    Commented Nov 28, 2021 at 12:47
  • $\begingroup$ Yes, you are right. I forgot that smaller negative numbers have a bigger magnitudes $\endgroup$
    – Robotex
    Commented Nov 29, 2021 at 8:30

2 Answers 2

5
$\begingroup$

True Anomaly is the angle from periapsis, through the center of the body being orbited, to a designated orbital position, measured in the plane of the orbit, with the positive direction designated as the direction of travel around the orbit.

If your true anomaly values are in the range $(-\pi, \pi]$ in radians or $(-180°, 180°]$ in degrees, sort them in ascending order. On an elliptical orbit, the body will visit these true anomalies once each orbit in that order. On a parabolic or hyperbolic trajectory, it will visit them once, in that order.

If your calculations have resulted in true anomaly values outside those ranges, you can convert the angles to put them in that range. There are many ways to do this, I typically use the arctan2 functon. Given an initial true anomaly value $\theta$:

$$f = \mathrm{arctan2}(\sin \theta, \cos \theta)$$

$f$ will be in the range $(-\pi, \pi]$ or $(-180°, 180°]$ as appropriate, and you can sort in ascending order, as above.

$\endgroup$
4
  • $\begingroup$ Interesting! $ \mod(\theta + \pi, \ 2 \pi) - \pi \ $ also works. You might point out that technically the answer is impossible; for a proper Kepler orbit there's no way to know if there aren't an integer number of rotations between points; 0 might come n + 1/2 periods after $\pi$. $\endgroup$
    – uhoh
    Commented Nov 28, 2021 at 23:23
  • 2
    $\begingroup$ @uhoh Yes, the modulus works mathematically; I tend to shy away from it here because its implementation across programming languages with floating point and negative numbers can be inconsistent . As far as extra integer number of rotations; As posed, the question only provided a list of true anomalies, and extra rotations are irrelevant. On a Keplerian orbit, there's no way you go from $f=20°$ to $f=30°$ without passing through $f=25°$ $\endgroup$
    – notovny
    Commented Nov 28, 2021 at 23:47
  • $\begingroup$ That's good to know about $\mod() $, thanks! I read it as the OP having a table of events and assuming the orbit is healthy there can be a large number of occurrences of 25°, only one of which is between a given adjacent pair of 20° and 30°. I guess as long as the question is short and ambiguous, it can be taken either way. $\endgroup$
    – uhoh
    Commented Nov 29, 2021 at 0:03
  • $\begingroup$ @notovny For i.e. space craft's position is Pi/2 and we have a list of anomalies (Pi/4, -Pi/2, Pi, 0, 3Pi/4). If I sort it just in ascending order, I will get a list (-Pi/2, 0, Pi/4, 3Pi/4, Pi) which is wrong. The correct list is (3Pi/4, Pi, -Pi/2, 0, Pi/4). Maybe, I should first extract the current spacecraft's anomaly from each anomaly in list and then add 2Pi to all anomalies that are below to zero. Then sort list and convert values back $\endgroup$
    – Robotex
    Commented Nov 29, 2021 at 12:13
0
$\begingroup$

If we have a random list of true anomalies in range [-PI;PI] we can sort it using next algorithm:

  1. Substract from each anomaly the current position's anomaly.
  2. Add 2*PI to each anomaly value that is lesser than 0
  3. Sort list of anomalies in ascending order
  4. Add current position's anomaly to each anomaly in list.
  5. Substract 2*PI from each anomaly value that greater than PI

After this steps we will receive the anomalies list sorted in following order.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.