I have rocks orbiting moons, moons orbiting planets, planets orbiting suns, and suns orbiting black holes, and the current system could have many many layers of orbitage.

the position of any object is a function of time and relative to the object it orbits.
(so far so good).

now I want to know for a given 2 objects(A,B), a start time and a speed, how can I work out the when and where to go. I can work out where A and B is given a time.
so i just need.

1: direction to travel in from A to B(remember B is moving(not in a straight line))
2: Time to get to b in a straight line. 

travel must be in a straight line with the shortest possible distance.

as an extension to this question, how will i know if its better to wait, EG is it faster to stay on object A and wait for a hour when the objects may be closer, than to set off from A to B at the start.

Cheers, it hurt my brain.


Question: difference between metadata and tooling API
Answer: While there is overlap, the Tooling API is specifically designed to help developers build IDE apps for salesforce, while the metadata API is more general purpose configuration migration. For example, you can get a symbol table for a class, such as it's members and functions, without writing your own parser. The metadata API is suitable for simple migrations, but the Tooling API gives developers a platform for debugging, code coverage, auto complete, and more.

Consider the migration toolkit versus the Force.com IDE, and you'll see the difference. One lets you move configuration changes, the other lets you develop new code entirely (minus, if course, the fact that auto complete isn't present in current IDE builds). The Developer Console also shows the power of the Tooling API.

Technically, the Tooling API could completely replace the metadata API, since the metadata API, came first and is less powerful, but it will be supported for some time to come yet.

New projects should probably use the Tooling API as much as practical, but the metadata API is widely supported, in comparison, so it will be a while yet until it is completely replaced.