1

I'm trying to calculate the x, y and z coordinates of a simple circular orbit in 3d space.

Calculating an orbit on the XY plane has the following simple algorithm.

alpha = 0.0
deltaAlpha = 0.1
radius = 1000.0
while(true)
{
    posX = cos(alpha) * radius
    posY = sin(alpha) * radius
    posZ = 0.0

    // do something with pos values

    alpha += deltaAlpha;
}

I'm now trying to introduce an inclination (angle from the XY plane) to the algorithm but am struggling to find a solution. Can anyone help?

Andy C
  • 65
  • 1
  • 6
  • 1
    The easiest way to do this is to generate two orthogonal unit vectors u, v then points on the orbit on that plane can be described as radius*(cos(alpha) u + sin(alpha) v). To choose u and v, you need to decide in which direction you want the plane to be inclined. – Simon Goater Nov 23 '22 at 13:44
  • in case you are intersted in the real thing see [Is it possible to make realistic n-body solar system simulation in matter of size and mass?](https://stackoverflow.com/a/28020934/2521214) and all sublinks in there – Spektre Nov 24 '22 at 19:37

0 Answers0