1

I want to calculate x,y coordinates of point on orbit. I have radius (for example 1), coordinates of center of orbit (0,0) and the time it takes to make full circle on orbit (for example 2), starting coordinates of object(-radius,0), and I want to calculate x and y after 1 day, so it should be on radius,0. But how to calculate it without angle?

andand
  • 17,134
  • 11
  • 53
  • 79
sadge_user
  • 15
  • 6
  • 1
    circular or elliptical orbit? Your data suggest 2D circular however if you are doing physically correct model check [n-body simulation](https://stackoverflow.com/a/28020934/2521214) and [Solving Kepler's equation](https://stackoverflow.com/a/25403425/2521214) – Spektre Jun 10 '21 at 07:38

1 Answers1

4

You're going to have to start by translating the the orbit into a rotation rate, which will give you an equation for θ(t), where t and θ(t) is the angle (normally in radians) in the orbit at time t. The position would then be given by

X ← r·cos(θ(t)) + x0
Y ← r·sin(θ(t)) + y0

where r is the radius of your orbit (which you indicated was 1) and (x0, y0) is the center of the orbit (which you indicated was (0,0)).

If you want the point to have a constant rotation rate and arrive at (r, 0) after exactly 1 day, then your θ(t) would be a function of the form:

θ(t) ← 2·n·π·t + θ(0)

Where t is time in days and n is an integer value. θ(0) is just the starting angle which in your case will be π. There are an infinite number of other such functions which could permit this to occur if you wanted to use a non-constant rotation rate, but you would need to provide some additional requirements for that.

A more general function will permit you to specify the constant rotation rate α and calculate the angle at a time t. This would take on the form

θ(α, t) ← 2·α·π·t + θ(0)

So in your example of a rotation rate of 2, θ(2, t) = 4·π·t

Coding this in Java is left as an exercise to the reader.

andand
  • 17,134
  • 11
  • 53
  • 79
  • @sadge_user, You need to be clear on the units. A rotation rate of '2' means what exactly? Is that 2 degrees, 2 radians, 2 complete revolutions around the center? If it's degrees, use θ(t) ← 2·π·t/180 + θ(0); If radians, use θ(t) = 2·t + θ(0). If it's two rotations, use the first formulation and set n=2 or that last formulation, θ(2, t) = 4·π·t. – andand Jun 10 '21 at 02:03