4

I have line segment from

Start Point ($x1$,$y1$) = (279,268) and End Point ($x2$,$y2$) = (281,198)

I want to increase the length of line by 5, 10, 20 etc in end point direction.

i.e value of $y2$ should decrease like 198 -> 193 -> 183 - 163 etc.

Is there any formula through which i can get new values of ($x2$,$y2$) by providing the increase in length constant c (5, 10, 20)?

Thanks

2 Answers2

6

Compute $$ \Delta_x=\frac{x_2-x_1}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}} $$ and $$ \Delta_y=\frac{y_2-y_1}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}}. $$

Then your new point has coordinates $$ (x_2+c\Delta_x, y_2+c\Delta_y). $$

Eckhard
  • 7,705
0

The new endpoint is given by $$(x^\prime_2,y^\prime_2) = (x_2,y_2) + \frac{l}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}}(x_2-x_1,y_2-y_1) = (281+\frac{l\sqrt{1226}}{1226},198-\frac{35l\sqrt{1226}}{1226}),$$

where $l$ is the additional length of the line.

Abel
  • 7,312