Open rtoole13 opened 4 years ago
This amounts to calculating minimum orbit intersection distance (MOID), yet another delightfully not-so-trivial problem
At epoch for and consecutive epochs (elliptical trajectories) for GravityAffected object a, kick off coroutines to calculate MOID for against each GravitySource object b that meets a certain criteria (I suppose a point on object a's trajectory getting within object b's ROI). For a dumb first pass, iterate t over P (one period) some n times, solving for a's position and b's position at time tn. Report the minimum of all n positions.
Potentially dumber, less accurate, but less taxing calculation, get minimum distance between two object trajectories. Get object a's time of flight to that point of minimum distance, rA on object a's orbit. Given that time of flight, calculate object b's position at that time, position rB. Consider that a rough estimation of "closest encounter", and place a marker at rA and rB on object a's orbit and b's orbit, respectively.
Plot trajectory intersections or closest points in position and time