Subtracting O's position from X's will give you a vector. A vector is a direction and a displacement. That should probably help you.

EDIT: Fixed a typo!

Last edited by MrWizard; 10-10-2002 at 10:59 AM.

"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Okay, some basic mathematics. We have a point O and a point X in 2D cartesian space. X - O = V ( a 2D vector ).

P = O + kV

where P is our new point , O is our original point, k is a scalar between 0 and 1 and V is our vector. You see, if we have 0 for k we get point O. If we use 1 for k we get the endpoint of the vector, or X. So, by incrementing k we will affectively move along this line towards X our destination. Hope this helped you. Let me know if I need to clarify.

mmm..What about the x and y values of "O"? ALso in your first post you actually said to minus X off O, which is O - X, so i was confused ^.^, and i still is. How do you calculate the x and y values along the straight path towards the new point?