I am trying to find the relationship between the vertical distance (V) from the center of the square to the line to the perpendicular distance (P) from the center of the square to the line in terms of slope.
I know the answer. The vertical distances are related to the perdendicular distances by a factor of such that p=cv where dx=x2-x1 and dy = y2-y1
However I do not know how to find this relationship...can someone step through the math that arrives at this?
In the image I have increased the size of the square. In my problem I am trying to find this relationship for each square in the grid that the line cuts through. Then I can find P at any square on the grid. I believe the relationship should be the same in either case.