Talon Mcbride

Answered

2022-07-17

How to find the third point at a given distance angle from a line segment in a plane?

Suppose i have a plane and a line segment with end points $({x}_{1},{y}_{1}),({x}_{2},{y}_{2})$ is given to us.Now we need to find another point which lies at distance d from $({x}_{2},{y}_{2})$ , making an angle θ in such a way that if we go from $({x}_{1},{y}_{1})$ to $({x}_{2},{y}_{2})$ and then to $({x}_{3},{y}_{3})$ it forms counterclockwise direction.

Note : $p1=({x}_{1},{y}_{1}),p2=({x}_{2},{y}_{2}),p3=({x}_{3},{y}_{3})$

My approach : we can use dot product and it will give us equation of for Ax+By=C where A,B,C are constants.Then we can use information given by d. After solving two equations we will get two points , one in clockwise direction and other in counterclockwise direction . We can get out desired point using cross product (it will be negative for the point we want and positive for the other point).

You see that my approach is very lengthy .Is there any shortapproach ?

Suppose i have a plane and a line segment with end points $({x}_{1},{y}_{1}),({x}_{2},{y}_{2})$ is given to us.Now we need to find another point which lies at distance d from $({x}_{2},{y}_{2})$ , making an angle θ in such a way that if we go from $({x}_{1},{y}_{1})$ to $({x}_{2},{y}_{2})$ and then to $({x}_{3},{y}_{3})$ it forms counterclockwise direction.

Note : $p1=({x}_{1},{y}_{1}),p2=({x}_{2},{y}_{2}),p3=({x}_{3},{y}_{3})$

My approach : we can use dot product and it will give us equation of for Ax+By=C where A,B,C are constants.Then we can use information given by d. After solving two equations we will get two points , one in clockwise direction and other in counterclockwise direction . We can get out desired point using cross product (it will be negative for the point we want and positive for the other point).

You see that my approach is very lengthy .Is there any shortapproach ?

Answer & Explanation

Danica Ray

Expert

2022-07-18Added 15 answers

Let

${\overrightarrow{p}}_{1}=\left[\begin{array}{c}{x}_{1}\\ {y}_{1}\end{array}\right],\phantom{\rule{1em}{0ex}}{\overrightarrow{p}}_{2}=\left[\begin{array}{c}{x}_{2}\\ {y}_{2}\end{array}\right],\phantom{\rule{1em}{0ex}}{\overrightarrow{p}}_{3}=\left[\begin{array}{c}{x}_{3}\\ {y}_{3}\end{array}\right]$

Distance between ${\overrightarrow{p}}_{1}$ and ${\overrightarrow{p}}_{2}$ is r,

$r=\Vert {\overrightarrow{p}}_{2}-{\overrightarrow{p}}_{1}\Vert =\sqrt{({x}_{2}-{x}_{1}{)}^{2}+({y}_{2}-{y}_{1}{)}^{2}}$

Rotating a vector clockwise by $\phi $ around origin is

$\left[\begin{array}{c}{x}_{\text{new}}\\ {y}_{\text{new}}\end{array}\right]=\left[\begin{array}{cc}\mathrm{cos}\phi & \mathrm{sin}\phi \\ -\mathrm{sin}\phi & \mathrm{cos}\phi \end{array}\right]\left[\begin{array}{c}{x}_{\text{old}}\\ {y}_{\text{old}}\end{array}\right]$

For counterclockwise rotation, use the transposed matrix (change both $\mathrm{sin}\phi $ signs).

It seems to me we want to take the vector from ${\overrightarrow{p}}_{2}$ to ${\overrightarrow{p}}_{1}$ (i.e. ${\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2}$), scale it by d/r (so it will have Euclidean length d), and then rotate it around ${\overrightarrow{p}}_{2}$ clockwise by $\theta $. (The order of scaling and rotating doesn't matter, of course.)

Using

${\mathbf{R}}_{\theta}=\left[\begin{array}{cc}\mathrm{cos}\theta & \mathrm{sin}\theta \\ -\mathrm{sin}\theta & \mathrm{cos}\theta \end{array}\right]$

in vector notation this would be

${\overrightarrow{p}}_{3}={\overrightarrow{p}}_{2}+\frac{d}{r}{\mathbf{R}}_{\theta}{\textstyle (}{\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2}{\textstyle )}$

i.e.

${\overrightarrow{p}}_{3}={\overrightarrow{p}}_{2}+\frac{d}{\sqrt{({\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2})\cdot ({\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2})}}{\mathbf{R}}_{\theta}{\textstyle (}{\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2}{\textstyle )}$

and the Cartesian coordinate notation is

$\{\text{}\begin{array}{rl}{x}_{3}& ={x}_{2}+\frac{d({x}_{1}-{x}_{2})\mathrm{cos}\theta +d({y}_{1}-{y}_{2})\mathrm{sin}\theta}{\sqrt{({x}_{1}-{x}_{2}{)}^{2}+({y}_{1}-{y}_{2}{)}^{2}}}\\ {y}_{3}& ={y}_{2}+\frac{d({y}_{1}-{y}_{2})\mathrm{cos}\theta -d({x}_{1}-{x}_{2})\mathrm{sin}\theta}{\sqrt{({x}_{1}-{x}_{2}{)}^{2}+({y}_{1}-{y}_{2}{)}^{2}}}\end{array}$

${\overrightarrow{p}}_{1}=\left[\begin{array}{c}{x}_{1}\\ {y}_{1}\end{array}\right],\phantom{\rule{1em}{0ex}}{\overrightarrow{p}}_{2}=\left[\begin{array}{c}{x}_{2}\\ {y}_{2}\end{array}\right],\phantom{\rule{1em}{0ex}}{\overrightarrow{p}}_{3}=\left[\begin{array}{c}{x}_{3}\\ {y}_{3}\end{array}\right]$

Distance between ${\overrightarrow{p}}_{1}$ and ${\overrightarrow{p}}_{2}$ is r,

$r=\Vert {\overrightarrow{p}}_{2}-{\overrightarrow{p}}_{1}\Vert =\sqrt{({x}_{2}-{x}_{1}{)}^{2}+({y}_{2}-{y}_{1}{)}^{2}}$

Rotating a vector clockwise by $\phi $ around origin is

$\left[\begin{array}{c}{x}_{\text{new}}\\ {y}_{\text{new}}\end{array}\right]=\left[\begin{array}{cc}\mathrm{cos}\phi & \mathrm{sin}\phi \\ -\mathrm{sin}\phi & \mathrm{cos}\phi \end{array}\right]\left[\begin{array}{c}{x}_{\text{old}}\\ {y}_{\text{old}}\end{array}\right]$

For counterclockwise rotation, use the transposed matrix (change both $\mathrm{sin}\phi $ signs).

It seems to me we want to take the vector from ${\overrightarrow{p}}_{2}$ to ${\overrightarrow{p}}_{1}$ (i.e. ${\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2}$), scale it by d/r (so it will have Euclidean length d), and then rotate it around ${\overrightarrow{p}}_{2}$ clockwise by $\theta $. (The order of scaling and rotating doesn't matter, of course.)

Using

${\mathbf{R}}_{\theta}=\left[\begin{array}{cc}\mathrm{cos}\theta & \mathrm{sin}\theta \\ -\mathrm{sin}\theta & \mathrm{cos}\theta \end{array}\right]$

in vector notation this would be

${\overrightarrow{p}}_{3}={\overrightarrow{p}}_{2}+\frac{d}{r}{\mathbf{R}}_{\theta}{\textstyle (}{\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2}{\textstyle )}$

i.e.

${\overrightarrow{p}}_{3}={\overrightarrow{p}}_{2}+\frac{d}{\sqrt{({\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2})\cdot ({\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2})}}{\mathbf{R}}_{\theta}{\textstyle (}{\overrightarrow{p}}_{1}-{\overrightarrow{p}}_{2}{\textstyle )}$

and the Cartesian coordinate notation is

$\{\text{}\begin{array}{rl}{x}_{3}& ={x}_{2}+\frac{d({x}_{1}-{x}_{2})\mathrm{cos}\theta +d({y}_{1}-{y}_{2})\mathrm{sin}\theta}{\sqrt{({x}_{1}-{x}_{2}{)}^{2}+({y}_{1}-{y}_{2}{)}^{2}}}\\ {y}_{3}& ={y}_{2}+\frac{d({y}_{1}-{y}_{2})\mathrm{cos}\theta -d({x}_{1}-{x}_{2})\mathrm{sin}\theta}{\sqrt{({x}_{1}-{x}_{2}{)}^{2}+({y}_{1}-{y}_{2}{)}^{2}}}\end{array}$

Most Popular Questions