0

I have a line with slope given as the pair: dx, dy (slope: dy/dx).

Given a point (x, y) on the line, what are the coordinates (x(d), y(d)) of the 2 points such that the distance from (x,y) measured on that line is equal to d (where d is any positive value)?

I would like a simple closed-form to be used in a program (to be coded) [better if can avoid trigonometry and use coordinates alone]. Thanks

Jada
  • 137
  • 10

1 Answers1

2

You are looking for a scaling factor $\alpha$ such that you can traverse your line $d$ units in the direction of the slope $dy/dx=(\alpha dy)/(\alpha dx)$. The distance $d$ is the hypoteneus: $$d^2 = (\alpha dx)^2 + (\alpha dy)^2 = \alpha^2 (dx^2 + dy^2) $$ which is clearly $$ \alpha = \sqrt{\frac{d^2}{dx^2 + dy^2} }$$ as long as the denominator is not $0$ and all numbers are real numbers.

So the points are $(x+\alpha dx, y+\alpha dy)$ and $(x-\alpha dx, y-\alpha dy)$

NazimJ
  • 3,244