How to find a point between two points with given distance?

Here are some hints:

  1. Find the unit vector that points from P1 to P2.
  2. Multiply that vector by $3$ and add it to P1.

In general terms, the unit vector is

$$\hat{u} = \frac{x_2-x_1}{D}\hat{x} + \frac{y_2-y_1}{D}\hat{y},$$

where $\hat{x}, \hat{y}$ are unit vectors in the $x$ and $y$ directions, and $D = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$ is the distance between $P_1$ and $P_2$.

Then, if you're looking for the point a distance $d$ away from $P_1$ along the line through $P_1$ and $P_2$, then, vector-based the answer is

$$\vec{P_3} = \vec{P_1} + d\hat{u}.$$

Splitting up the components gives:

$$x_3 = x_1 + \frac{d}{D}(x_2-x_1)$$

$$y_3 = y_1 + \frac{d}{D}(y_2-y_1).$$


A point on the line through $P_1$ and $P_2$ will have the form $$\mathbf x = (1-\lambda)P_1 + \lambda P_2$$ for some $\lambda \in \mathbb R$. If $\lambda \in [0,1]$, then $\mathbf x$ will be on the line segment between $P_1$ and $P_2$. In particular, when $\lambda = 1$, then $\mathbf x = P_2$.

Let's scale $\lambda$ to $\lambda'$ so that $\mathbf x = P_2$ when $\lambda' = 10\sqrt2$, which is the distance from $P_1$ to $P_2$. In other words, we have $\lambda' = 10\sqrt2\lambda$, so $$\mathbf x = \left(1-\frac{\lambda'}{10\sqrt2}\right)P_1 + \frac{\lambda'}{10\sqrt2}P_2.$$

Now substitute $\lambda' = 3$.

Tags:

Geometry