Move a point on a line created with two points

151 Views Asked by At

I have a problem where I have to move a third point between two points. The third point is not on the same line as the other two. It has to be moved between two points such that the distance remains the same in proportion. I have applied this

solution

but due to distance not being the same after it comes on the line, it doesn't get placed in the desired position.

The picture will explain the problem better.

enter image description here

3

There are 3 best solutions below

3
On

As I have finally understood, you are looking for the orthogonal projection of $(x_3,y_3)$ onto point $(x_4,y_4)$ which belongs to line segment [$M_1M_2$];

Therefore, we have to find the value of $a$ such that $M_4$ has coordinates :

$$\begin{cases}x_4=a x_1+(1-a)x_2\\y_4=a y_1+(1-a)y_2\end{cases}\tag{1}$$

such that distance $(M_3M_4)$ is minimal.

Let $$\begin{cases}X_2&:=&x_1-x_2\\Y_2&:=&y_1-y_2\end{cases}, \ \ \ \begin{cases}X_3&:=&x_1-x_3\\Y_3&:=&y_1-y_3\end{cases}$$

The looked for formula is :

$$a=\frac{-(X_2X_3+Y_2Y_3)}{X_2^2+Y_2^2}\tag{2}$$

that you just have to plug into (1).

Remark: you must have $0 \le a \le 1$. Otherwise, it means that the projection falls onto the line $[M_1M_2]$ but outside the segment.

Proof of (2): the squared distance between $M_3$ and $M_4$ is

$$(M_3M_4)^2=(a(x_1-x_2)+(x_1-x_3))^2+(a(y_1-y_2)+(y_1-y_3))^2$$

$$(M_3M_4)^2=(aX_2+X_3)^2+(aY_2+Y_3)^2$$

We then minimize it by expressing that its derivative with respect to $a$ is zero:

$$2a(X_2^2+Y_2^2)+2a(X_2X_3+Y_2Y_3)=0$$

0
On

ThreePoints

In the following answer, we describe a very simple construction, which could help OP to locate the point corresponding to the third point mentioned in the problem statement.

Draw line segments to join the third point $C\space \left(x_3, y_3\right)$ to the two end points of the given segment, i.e. $A\space \left(x_1, y_1\right)$ and $B\space \left(x_2, y_2\right)$ as shown the above diagram. Now, construct the internal angle bisector of $\measuredangle BCA$ to meet the segment $AB$ at $D$. We think that $D$ is the point OP is looking for.

As shown in $\mathrm{Fig.\space 1}$ and $\mathrm{Fig.\space 2}$, this construction places the point $D$ always between $A$ and $B$, whether the third point $C$ lies in the region demarcated by the two perpendiculars to the segment at its end points or not. Besides, the following relationship is always guaranteed by the point $D$. $$AD : DB = AC : CB$$

0
On

In this context if there are four points or more to compare segment relative lengths we could better say proportion else for three points only ratio may be okay, so I presumed.

Anyway we have an Apollonius Circle that divides lines between two (red) points as shown and the lines need not necessarily be collinear.

When collinear the harmonic ratio of division is a constant both externally and internally as given in Wiki in detail.

enter image description here

Wiki Apollonius Circles