Right coordinates of a slanting line when slope is zero and left coordinates never changed after transformation

113 Views Asked by At

I have a line in a program I am developing that I want to remove the slant (slope to zero) then get the new coordinates after transformation that removes the slope.

This is how the line with the slope looks like together with its coordinates (79, -131) and (158, -111)

This is the line without the slope ( when slope=0). How do I get the (x, y) coordinates after the transformation that changes it to a straight line at 180 degrees with no slope (slope = 0)? Note that I do not intend to change point (79,-131).

I will gladly appreciate all your help on this.

2

There are 2 best solutions below

2
On BEST ANSWER

$$ y-y_A=\dfrac{y_B-y_A}{x_B-x_A}(x-x_A) \iff y+131=\dfrac{-111+131}{158-79}\left(x-79\right) $$

Now Add another line with the negative of the previous slope and passing through the starting point of (79,-131). This transformation will get you a line that has zero slope and runs through the starting point .

I think this is what you are asking for.

Edit:

Initial Length of the line = $\sqrt{20^2 + 79^2} = \sqrt{6641}$

Now to preserve the length Equate $(x-79) = \sqrt{6641}$

$x= 160.4923$

The new coordiates are (160.4923, -131)

Good luck

1
On

If I well understand you have a line of equation: $$ y-y_A=\dfrac{y_B-y_A}{x_B-x_A}(x-x_A) \iff y+131=\dfrac{-111+131}{158-79}\left(x-79\right) $$ where the slope is $m=\dfrac{y_B-y_A}{x_B-x_A} =\dfrac{20}{79}$. If you want a new line with slope $0$ passing thorough the point $(79,-131)$ you can use the same formula with $m=0$ and you find $$y+131=0 \iff y=-131$$.

If you want the point on this line corresponding to $x=158$ you have simply $(158,-131)$