In $\Bbb R^3$, I want to find the point on a line that is a distance R away from another point (not on the line).

38 Views Asked by At

I have a point $A:\left(x_{A}, y_{A}, z_{A}\right)$ and a line $\vec{G}:\vec{g}+t\vec{u}$. I want to find the point on $\vec{G}$ that is a distance R away from $A$.

I know that $A$ is not on $\vec G$, and I do not want $A$ to be perpendicular to $\vec G$.

Thanks.

3

There are 3 best solutions below

0
On

There are two points. You have solve the quadratic equation $$\lVert\vec g+t\vec u -A\rVert^2=R^2.$$

0
On

Given a $t$ the distance of $(x_A,y_A,z_A)$ and the corresponding point of the line is

$$\sqrt{(g_x+tu_x-x_A)^2+(g_y+tu_y-y_A)^2+(g_z+tu_z-z_A)^2}.$$

We need the $t$ for which

$$\sqrt{(g_x+tu_x-x_A)^2+(g_y+tu_y-y_A)^2+(g_z+tu_z-z_A)^2}=3.$$

This is an equation in $t$. Let's solve it.

Squaring both sides we get

$$(g_x+tu_x-x_A)^2+(g_y+tu_y-y_A)^2+(g_z+tu_z-z_A)^2=9.$$

Then taking the squares of the terms

$$(g_x-x_A)^2+2tu_x(g_x-x_A)+t^2u_x^2+$$ $$+(g_y-y_A)^2+2tu_y(g_y-y_A)+t^2u_y^2+$$ $$+(g_z-z_A)^2+2tu_z(g_z-z_A)+t^2u_z^2-9=0.$$

This is a quadratic equation which can be written as follows

$$at^2+bt+c=0$$

where

$$a=u_x^2+u_y^2+u_z^2,$$

$$b=2(u_x(g_x-x_A)+u_y(g_y-y_A)+u_z(g_z-z_A)),$$ and $$c=-9.$$

0
On

If you know the distance between two points $\vec{A}$ and $\vec{B}$ is $||B-A||$ You can define a generic point $\vec{P}=\left(p_1,p_2,p_3\right)$ in your line $\vec{G}$ and solve the equation $R=||A-P||$