I need to make line B parallel to line A. I have start and end coordinates of line A and start coordinate of line B. Can I calculate the end coordinate of line B to make it parallel to line A. I also have end X coordinat. So all I actually need is end Y.
Any suggestions? Thank you.
Say your lines look like this: Y
You know the co-ordinates of P, Q and X and the x co-ordinate of Y.
Let's say that P is (a,b); Q is (c,d); X is (e,f) and Y is (g,h). You want to find h.
You know that the two lines are parallel and that means that their gradients are the same.
The gradient of a line is the amount of units that it moves up for every unit that it moves right.
The gradient of line PQ is (d-b)/(c-a) and the gradient of line XY is (h-f)/(g-e)
As these are the same, they can be combined into an equation: (d-b)/(c-a)=(h-f)/(g-e)
As we want to find h, we want to make it the subject of this equation.
Multiply by (g-e): (d-b)(g-e)/(c-a)=h-f
Add f: h=(d-b)(g-e)/(c-a)+f
And there's your y co-ordinate!
Why did the vector cross the road?
It wanted to be normal.
Thank you very much. It was very helpful and clear. And easy, what's the most important :-)