I am trying to draw an ellipse as satellite orbit in three.js, It has an EllipseCurve class which takes these inputs and draws an ellipse around center.

EllipseCurve( aX : Float, aY : Float, xRadius : Float, yRadius : Float, aStartAngle : Radians, aEndAngle : Radians, aClockwise : Boolean, aRotation : Radians )

aX – The X center of the ellipse.

aY – The Y center of the ellipse.

xRadius – The radius of the ellipse in the x direction.

yRadius – The radius of the ellipse in the y direction.

aStartAngle – The start angle of the curve in radians starting from the positive X axis.

aEndAngle – The end angle of the curve in radians starting from the positive X axis.

aClockwise – Whether the ellipse is drawn clockwise.

aRotation – The rotation angle of the ellipse in radians, counterclockwise from the positive X axis (optional).

enter image description here

I am much interested in how to calculate these required inputs from TLE to draw an orbit. So far i have found this post but i am not able to understand it properly.


1 Answer 1


It seems to me that EllipseCurve alone is not enough to represent satellite orbits, because it only deals with ellipses in a plane. To get the right 3D behavior, you will need to move the center, and then rotate out of the starting plane by matrix multiplication.

Even more complicated is the issue of how to obtain the numbers you want from a TLE! TLE format uses mean orbital elements, which do not mean what you think they mean! The best choice is generally to get the SGP4 library from https://www.space-track.org/documentation#/sgp4 , and ask it to compute the osculating elements at some particular time, which you can then use in drawing. Alternately, forget about drawing ellipses as such, and tell SGP4 to generate a list of points in whatever coordinates you like.

The parameters usually used to describe elliptical orbits are the Keplerian orbital elements: semi-major axis $a$, eccentricity $e$, inclination $i$, right ascension of the ascending node (RAAN) $\Omega$, argument of perigee $\omega$, and true anomaly $\theta$.

$a$ is half of the longest diameter of the ellipse, which equals either xRadius or yRadius, whichever is larger. The corresponding semi-minor axis, $b$, is the other radius, whichever is smaller. You should just pick one and stick with it, without loss of generality, since there are plenty of parameters left to go. For the rest of this post, I will assume that X is the longer direction, so xRadius $=a$ and yRadius $=b=a\sqrt{1-e^2}$, which serves to define eccentricity as a particular formula ($e=\sqrt{1-b^2/a^2}$) to measure how different $a$ is from $b$.

The next step is to note that in orbital mechanics, we don't normally think of ellipses in terms of their centers. We are more interested in one of the foci, because that's where the body being orbited actually is. The center is empty, and one of the two foci is empty, but the other focus is occupied by the center of mass of the system. For artificial satellites, the ratio of masses is $10^{19}$ (ISS) or more, so there's insignificant error in saying the occupied focus is the center of the Earth. For natural satellites (planets and moons), however, the mass ratio can be as low as $10^3$ (Sun : Jupiter) or $10^2$ (Earth : Moon), so you would need to take into account the position of the barycenter. In any case, you ought to move the center of your coordinate system to the position of the center of mass, which is located a distance $c=a\,e=\sqrt{a^2-b^2}$ from the geometrical center of the ellipse, along the X axis, either left or right at your convenience.

One of several parametric equations for the resulting ellipse is $x = -c + a \cos E,\, y=b \sin E$, where $E$ is the angle we call the eccentric anomaly. $E$ is measured counterclockwise with respect to the center of the ellipse. True anomaly, on the other hand, is measured counterclockwise with respect to the occupied focus of the ellipse (the position of the center of mass). Some authors denote true anomaly by $\theta$, while others use $\nu$ or $f$, but they're all the same thing. The parametric equation of an ellipse in polar coordinates with respect to the focus is $$r=\frac{a(1-e^2)}{1 + e\cos (\theta-\omega)}$$ where $\omega=$ aRotation is the argument of perigee (because when $\theta=\omega$, $r$ is minimized), but that is not enough to describe where satellite orbits really are. We need two more angles to specify the orientation in space of the plane of the ellipse, which can be anything. Inclination $i$ means how far from horizontal, with respect to the Earth's equator, is the orbit plane. To keep conventions consistent, we generally perform this rotation around the starting X axis, so as not to alter the value we need to put in for $\omega$ (aRotation). RAAN $\Omega$ means where does the ascending node (the place where a satellite with nonzero inclination crosses the plane of the equator from south to north) point, with respect to some arbitrary reference direction in the sky.

Performing the rotations in three.js is tricky, because there are many different possible conventions in defining Euler angles, and the one typically used in orbital mechanics is not the same as three.js chose, namely

Three.js uses intrinsic Tait-Bryan angles. This means that rotations are performed with respect to the local coordinate system. That is, for order 'XYZ', the rotation is first around the local-X axis (which is the same as the world-X axis), then around local-Y (which may now be different from the world Y-axis), then local-Z (which may be different from the world Z-axis).

$\Omega$, $i$, and $\omega$, on the other hand, are defined as rotations performed in the external system, first around the Z axis by $\Omega$, then around the original X axis by $i$, then around the original Z axis again by $\omega$ (which can be omitted if you already used $\omega$ as aRotation above). This Z-X-Z pattern is commonly used in many applications of Euler angles, but none of the six sequences available in three.js match it exactly, and it is not easy to convert from one representation to another. I think you would do better to stick with the equations from https://en.wikipedia.org/wiki/Orbital_elements#Euler_angle_transformations , unless you particularly want to learn about quaternions, in which case this is a marvelous opportunity.

Lastly, you may want to consider that any representation in which the orbit appears as a closed ellipse is necessarily an inertial frame (ECI), so you really ought to draw the Earth turning at the appropriate rate of $\sqrt{GM/a^3}$ radians per second, where $GM$ is the gravitational parameter of the body being orbited. If you want your Earth to stay still, then you have to draw a parametric curve a bit more complicated than an ellipse to represent its motion correctly.

  • $\begingroup$ Can you explain more about compute the osculating elements at some particular time step how this can be done using SGP4, currently i am using satellite.js to get ECI and lat long coordinate of satellite. $\endgroup$ Jun 23, 2022 at 23:33

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.