Connect the two points and get the equation of line using two-point form (the 3D generalization is simple).
I'm assuming P1 is to the right and P2 to the left. It may work with them reversed.