Jump to content

LatLon at UT with rotation query


Recommended Posts

Is it possible to get the Lat & Lon of an object (in orbit) as at a UT time that take into account planetary rotation?

I've tried the following:
Vector3d VESS_Position = ActiveVessel.orbit.getPositionAtUT(FutureUT);
Vector2d FutureVES_LatLon = LatLon.GetLatitudeAndLongitude(ActiveVessel.mainBody.BodyFrame, ActiveVessel.mainBody.position, VESS_Position);

However, this doesn't seem to factor in planet rotation.

Link to comment
Share on other sites

You know the rotation period of the planet, so you can determine how much you need to adjust the longitude based on that.  I think it's a case of determine the change in time (FutureUT - now), divide that by the Body.rotationPeriod (as long as the period isn't 0), take the fraction from that result, multiply by 360, and add or subtract (don't remember which) to the longitude.  And then normalize the result to [-180, +180].  That should get you the right answer, or at least get you pointed towards it - it's been a while since I messed with that type of problem.

Link to comment
Share on other sites

2 hours ago, MOARdV said:

You know the rotation period of the planet, so you can determine how much you need to adjust the longitude based on that.  I think it's a case of determine the change in time (FutureUT - now), divide that by the Body.rotationPeriod (as long as the period isn't 0), take the fraction from that result, multiply by 360, and add or subtract (don't remember which) to the longitude.  And then normalize the result to [-180, +180].  That should get you the right answer, or at least get you pointed towards it - it's been a while since I messed with that type of problem.

Thanks for the tip, I managed to find the code you were trying to remember

https://github.com/Mihara/RasterPropMonitor/blob/b32f65c07168dfe7c6c8f786ecc00e358cc894c3/SCANsatRPM/JSISCANsatRPM.cs#L277

One question - does this method work when at high latitudes?

Edited by cyberKerb
Link to comment
Share on other sites

 

7 hours ago, cyberKerb said:

One question - does this method work when at high latitudes?

As long as latitude +/- 90 define the axis of rotation, yeah.  It doesn't matter if the latitude is 0 or 89.99999 - the period of rotation is constant.  A given line of longitude will sweep across 360 degrees in a single day.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...