3
$\begingroup$

If I have two points in positive cartesian coordinates, how do I find:

  1. The slope of a line between those points
  2. The increment amount to get from $(x_1, y_1)$ to $(x_2, y_2)$ one dot at a time.

What I know so far is $m=\frac{y_2-y_1}{x_2-x_1}$

But that gives me a single number, I need a pair of numbers I can add to $x$ and $y$ over the course of a series of iterations to reach $(x_2,y_2)$.

Thanks

1 Answers 1

1

For every increment (displacement) $t$ that you add to the $x$-coordinate, you add $mt$ to the $y$ coordinate. So $(x,y)$ becomes $(x+t,y+mt)$.

  • 0
    @alphablender: That's correct. And if you want exactly $n$ increments to go from $(x_1,y_1)$ to $(x_2,y_2)$, just make the increment equal to the x-interval divided by $n$. In other words, make $t=(x_2-x_1)/n$.2011-08-05