Find a point on finite line which has a given radius

43 Views Asked by At

I have given a line L defined by two points $(x_1,y_1)$ $(x_2,y_2)$. I want to find a point on the line which has a given radius $r$.

enter image description here

I already have a solution with the approach to calculate the intersection point between a finite line and a circle. Is there a solution which is more simple?

1

There are 1 best solutions below

2
On BEST ANSWER

One way which you might find easier is to write the coordinates of the point of interest in the form $$(r\cos\theta,r\sin\theta)$$

This point lies on the line $$y-y_1=m(x-x_1)$$ where $$m=\frac{y_2-y_1}{x_2-x_1}$$

In which case, $\theta $ satisfies $$r\sin\theta-mr\cos\theta=y_1-mx_1$$

This can be written, using a compound angle transformation, as $$\sin(\theta-\arctan m)=\frac{y_1-mx_1}{r\sqrt{1+m^2}}$$

You can then find the value of $\theta$.

You might find this numerically simpler than the method you described.