# Convert x and y velocity to x and y velocity relative to another point

The question I asked probably isn't very clear, so I'll explain. If I have an x and y velocity, where the y goes towards the bottom of the screen, and the x goes towards the right of the screen, how would I convert the x and y velocity so that the y goes from the point to the particle at hand, and the x goes at a 90 degree angle from the y? If that explanation wasn't clear, then the reason I need to do this is so that I can minus a velocity as a particle tries to go away from a gravity source, but that source isn't just at the bottom of the screen.

What I have:

What I want:

Examples would be appreciated

• This question is probably better asked in Maths, as its hard to see the programming aspect in how the question is worded. – Michael Shaw Mar 7 '15 at 20:19
• I'm quite confused about this question, and I'm not sure what the mathematical and physical problems you're asking about precisely is. For example, velocity is invariant under translation (velocity is a vector, which is just a direction and a size; it's not coupled to a specific location). Gravitational acceleration diminishes with the inverse square of the distance, and modelling proper gravitational atraction is pretty trivial once you know the formula. Your image indicates you want to switch the coordinate system, but that's unnecessary – why precisely would you want to do that? – amon Mar 7 '15 at 23:33
• @amon This could all be me overthinking my problem, but I just need an example of where you decrease the velocity of an object, because it is moving away from a source of gravity. I'm not sure if I'm correct, but I think you only decrease the velocity going away from the source of gravity, which is why I intended to switch coordinate systems, so you only decrease the velocity going away, not the (in the question example) x velocity. – Orfby Mar 8 '15 at 8:35