7
$\begingroup$

I have been struggling for a few days with this.

I know just my distance from gravity origin, gravity source mass and my actual velocity vector on the orbit. Can I calculate whole trajectory with this? Is it enough to know just these two vectors?

I need to calculate the major and minor axis and eccentricity. It is for small satellites orbiting the Earth.

$\endgroup$
8
  • 2
    $\begingroup$ re: is it enough to know just these 2 vectors . A way to think about it: Those are the only parameters that we have. We have only the present. That's what the "universe knows" right now about the Earth and Sun. it has the current Earth speed vector, the current distance vector and mass. Apparently that's enough for it to "calculate" the trajectory. $\endgroup$
    – d_e
    Jun 2, 2022 at 21:28
  • $\begingroup$ The oblateness of the Earth has a huge influence on most orbits. $\endgroup$ Jun 3, 2022 at 11:38
  • 1
    $\begingroup$ Related: Homework policy $\endgroup$ Jun 3, 2022 at 11:40
  • 1
    $\begingroup$ @d_e: The Earth is not a point mass or spherical. $\endgroup$ Jun 3, 2022 at 11:43
  • 2
    $\begingroup$ I actually wrote this section of the Wikipedia article because I was so frustrated that I couldn't find it explicitly written out anywhere else: en.wikipedia.org/wiki/… $\endgroup$ Jun 3, 2022 at 11:48

3 Answers 3

9
$\begingroup$

Sure, these parameters all fall out of orbital energy:

$$E=\frac{|\vec{v}|^2}{2}-\frac{\mu}{|\vec{r}|}$$ $$E=-\frac{1}{2}\frac{\mu^2}{|\vec{h}|^2}(1-e^2)$$ $$E=-\frac{\mu}{2a}$$

where $\vec{v}$ is the velocity vector, $\vec{r}$ is the position vector, $\vec{h}=\vec{r} \times \vec{v}$ is the specific relative angular momentum, and $\mu$ is the standard gravitational parameter, $e$ is the eccentricity, and $a$ is the semi-major axis. Calculate $E$ in the first equation, solve and calculate $e$ in the second equation, solve and calculate $a$ in the third equation.

Calculate the semi-minor axis $b$ with $b=a\sqrt{1-e^2}$.

$\endgroup$
2
  • $\begingroup$ Note that if we wish to express ourselves rigorously, we should say: ...where v is the modulus of the velocity vector, r is the modulus of the position vector, $h=\vert r \times v \vert$ is the modulus of the specific angular momentum... $\endgroup$
    – Albert
    Jun 3, 2022 at 6:40
  • $\begingroup$ @Albert This answer is just a "back of the napkin", but I added some vector notation to clarify. $\endgroup$
    – Connor Garcia
    Jun 3, 2022 at 16:30
9
$\begingroup$

I had this same problem several years ago and despite searching for it extensively, I could not find it explicitly spelled-out anywhere, so I had to derive it myself. I am not a physicist and frankly I found the whole thing so frustrating that, as I mentioned in the comments, I added this section to the Wikipedia article so that other people would not have to go through the same thing:

Elliptic orbit From Initial Position and Velocity

An orbit equation defines the path of an orbiting body $m_2\,\!$ around central body $m_1\,\!$ relative to $m_1\,\!$, without specifying position as a function of time (trajectory). If the eccentricity is less than 1 then the equation of motion describes an elliptical orbit. Because Kepler's equation ($M = E - e \sin E$) has no general closed-form solution for the Eccentric anomaly ($E$) in terms of the Mean anomaly (M), equations of motion as a function of time also have no closed-form solution (although numerical solutions exist for both).

However, closed-form time-independent (path) equations of an elliptic orbit with respect to a central body can be determined from just an initial position ($\mathbf{r}$) and velocity ($\mathbf{v}$) (and the mass(es)).

For this case it is convenient to use the following assumptions:

  1. The central body’s position is at the origin and is the primary focus ($\mathbf{F1}$) of the ellipse (alternatively, the center of mass may be used instead if the orbiting body has a significant mass)
  2. The central body’s mass (m1) is known
  3. The orbiting body’s initial position($\mathbf{r}$) and velocity($\mathbf{v}$) are known
  4. The ellipse lies within the XY-plane

The fourth assumption can be made without loss of generality because any three points (or vectors) must lie within a common plane. Under these assumptions the second focus (sometimes called the “empty” focus) must also lie within the XY-plane: $\mathbf{F2} = \left(f_x,f_y\right)$ .

Using Vectors

The general equation of an ellipse under these assumptions using vectors is:

$$ |\mathbf{F2} - \mathbf{p}| + |\mathbf{p}| = 2a \qquad\mid z=0$$

where:

  • $a\,\!$ is the length of the semi-major axis.
  • $\mathbf{F2} = \left(f_x,f_y\right)$ is the second (“empty”) focus.
  • $\mathbf{p} = \left(x,y\right)$ is any (x,y) value satisfying the equation.

The semi-major axis length (a) can be calculated as:

$$a = \frac{\mu |\mathbf{r}|}{2\mu - |\mathbf{r}| \mathbf{v}^2}$$

where $\mu\ = Gm_1$ is the standard gravitational parameter.

The empty focus ($\mathbf{F2} = \left(f_x,f_y\right)$) can be found by first determining the Eccentricity vector:

$$\mathbf{e} = \frac{\mathbf{r}}{|\mathbf{r}|} - \frac{\mathbf{v}\times \mathbf{h}}{\mu}$$

Where $\mathbf{h}$ is the specific angular momentum of the orbiting body:

$$\mathbf{h} = \mathbf{r} \times \mathbf{v}$$

Then

$$\mathbf{F2} = -2a\mathbf{e}$$

Using XY Coordinates

This can be done in cartesian coordinates using the following procedure:

The general equation of an ellipse under the assumptions above is:

$$ \sqrt{ \left(f_x - x\right)^2 + \left(f_y - y\right)^2} + \sqrt{ x^2 + y^2 } = 2a \qquad\mid z=0$$

Given:

  • the initial position coordinates $r_x, r_y \quad$
  • the initial velocity coordinate $v_x, v_y \quad$
  • and the gravitational parameter $\mu = Gm_1 \quad$

Then, specific angular momentum: $$h = r_x v_y - r_y v_x \quad$$ initial distance from F1 (at the origin): $$r = \sqrt{r_x^2 + r_y^2} \quad$$ the semi-major axis length: $$a = \frac{\mu r}{2\mu - r \left(v_x^2 + v_y^2 \right)} \quad$$ the Eccentricity vector coordinates: $$e_x = \frac{r_x}{r} - \frac{h v_y}{\mu} \quad$$ $$e_y = \frac{r_y}{r} + \frac{h v_x}{\mu} \quad$$

Finally, the empty focus coordinates: $$f_x = - 2 a e_x \quad$$ $$f_y = - 2 a e_y \quad$$

Now the result values $f_x$, $f_y$ and $a$ can be applied to the general ellipse equation above.


If this is for orbits around the earth or any other irregular body then you should keep in mind that the equations above are only valid for systems that can be modelled accurately as 2-body systems with point-masses or concentrically symmetrical masses. A satellite around the earth is actually typically modelled as the fourth body in a 4-body/3-mass (earth, moon, sun) system in 3 dimensions with the earth as an oblate spheroid. You can model it as a 2-body point-mass system in 2 dimensions (with the equations above) but it may not be sufficiently accurate for your purposes.

$\endgroup$
9
  • 1
    $\begingroup$ Thank you for this! My purposes are just for 2-body systems. So it fits perfectly. $\endgroup$ Jun 3, 2022 at 19:07
  • $\begingroup$ Maybe I misunderstood something, but first equation of major axis "a" should be constant during whole orbit. But as my velocity changes also major axis obviously changes too. I am testing it on very small scale, so my G constant is 500. Distance from gravity origin is 18m and starting velocity 40m. According premodeled trajectory eccentricity should be 13m and major axis 19m. But calculated result of major axis is between 0.0001 and 0.001 $\endgroup$ Jun 3, 2022 at 19:34
  • $\begingroup$ @WillyamCarkey The semi-major axis (a) is calculated from both the current position (r) and the current velocity vector (v). As the body in orbit changes its position around the elliptical orbit, it’s velocity also changes in such a way that the parameters of the ellipse, including (a) will stay the same, because it is still describing the same ellipse. $\endgroup$ Jun 3, 2022 at 21:28
  • $\begingroup$ I understand it, yet semi-major axis is changing each frame during movement. But it should not do so. Result is not constant and its number is very small. $\endgroup$ Jun 3, 2022 at 22:01
  • 2
    $\begingroup$ @WillyamCarkey if your orbital eccentricity is $13$ (eccentricity is a dimensionless ratio), your spacecraft is on a high-energy hyperbolic trajectory, rather than an elliptical orbit. $\endgroup$
    – notovny
    Jun 4, 2022 at 9:34
1
$\begingroup$

Thanks to all for help. Now everything is working just fine thanks to RBarryYoung! For others who struggle with the same problem Im sharing the code (python). Works only in XZ plain yet:

#Standard gravitational parameter - (Earth)
var u = G*M

#Velocity vector
var Vx = velocity.x
var Vy = velocity.y #is zero
var Vz = velocity.z

#Distance from gravity origin (in this case its Vector3(0,0,0) )
var Rx = global_transform.origin.x
var Ry = global_transform.origin.y #is zero
var Rz = global_transform.origin.z

#specific angular momentum
var h = Rx*Vz - Rz*Vx

#initial distance from gravity origin
var r = sqrt((Rx*Rx) + (Rz*Rz))

#semi-major axis
var a = (u*r)/(2*u - r*(Vx*Vx + Vz*Vz))

#eccentricity
var ex = (Rx/r)-((h*Vz)/u)
var ey = 0
var ez = (Rz/r)+((h*Vx)/u)
var e = Vector3(ex,ey,ez)

#semi-minor axis
var b = (a*sqrt(1-(e.length()*e.length())))/a   #minor axis (0...1)

#empty focus point coordinates
var Fx = -2*a*ex
var Fy = 0
var Fz = -2*a*ez
var F2 = -Vector3(Fx,Fy,Fz)

After this draw ellipse by integrated function or your own with "a" and "b" as parameters of semi-major and semi-minor axis After this offset whole ellipse by "e" - eccentricity parameter

Finally rotate ellipse towards F2 vector using -atan2(F2.z,F2.x)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .