I have a 2D Coordinate system where The Origin Starts at the top Left (Y Is higher as I move downward) I am Given Two Points in Space, Lets Say Point A, and Point B. How can I determine that next Point on the line From Point A to Point B? For example, I have Point A(10, 10) and Point B (1,1) I know the point I'm looking for is (9,9). But how do I do this mathematically? For say a more complicated Set of points A(731, 911) and B(200, 1298)
I'm trying to move my mouse, one pixel at a time from its current location to a new one.
This doesn't work, but honestly I'm stumped where to begin.
int rise = x2 - 460; //(460 is Point A x)
int run = y2 - 360;//(360 is Point A Y)
float slope = rise / run;
int newx = x1 + ((slope / slope) * 1); //x1 Is my current mouse POS x
int newy = y1 + (slope * -1);//y1 is my current mouse Pos y
It almost works but seems inverted, and wrong.