I have a point [x1,y1]
, a slope m
of a line that passes through that point. I'd like to find either point [x,y]
that is d
distance away from that original point.
Work so far:
$$ y = m(x - x_1) + y_1 $$ $$ x = \frac{y + mx_1 - y_1}m $$
And then (if my algebra is correct)
$$
d = \sqrt{ \left(\frac{y + mx_1 - y_1} m\right)^2 +y^2}
$$
$$
y^2 = d^2 - \left(\frac{y + mx_1 - y_1}{m}\right)\left(\frac{y + mx_1 - y_1}{m}\right)
$$
And then, if I plugged in some real numbers and struggled long enough, I suppose I could solve for y
. And then solve for x
. My first attempt ended in a few pages of poorly-remembered math and an incorrect answer.
My question is that this seems like a long slog. Is there an easier way?
More details: The general problem I'm trying to solve for a computer program is given a line segment find a point that is perpendicular and a fixed distance away from the mid-point.