Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a C++ program where I'd like to be able to see the Suns direction vector and distance from Earth at a given time, since 2000 Jan 0.0 TDT. The reference frame I want to calculate it is from the Earth, with the up vector running along the axis of the poles.

What I have tried so far has been based off, but its not entirely the output I'm after; and I feel I can probably achieve this much easier.

Any ideas? Sorry if this is off-topic.

share|cite|improve this question

For stuff like that, JPL NAIF's SPICE toolkit is useful. It allows determination of vectors between any heavenly bodies in our solar system, get their orientations, allows for choosing between where a body appears to be due to the finite speed of light vs. where it actually is at the same time, account for leap seconds and so on.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.