Compute intersection coordinates of two vectors moving on different speeds The red dot is moving at speed 400 in direction of the green dot.
I want to move the yellow dot to the coordinates of the red dot after the time needed for the yellow dot to reach the position.
In other words, I want the yellow dot to intercept the red one to make them overlap before the red dot reaches the green dot coordinates.



I'm using this function to get the distance between dots:
function getDistance(a, b) {
    return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
}

And this one to normalize the distances taking into account the speeds:
function normalizeDistance(distance, speed) {
    return distance / speed;
}

But I can't find out how to obtain the information I need.  
I logically know the coordinates of the 3 dots and I know that the red dot is going to head in the coordinates of the green one.
The green dot is static.
How can I do?
Edit:
To clarify, here's simpler examples for the same problem:



 A: Let us describe the red dot's position at time $t$ by 
$$x_R(t) = R_0 + 400t\vec{R}$$
where $R_0$ is the initial position of the red dot and $\vec{R}$ is the direction it is moving in. Similarly we can do this for the yellow dot with
$$x_Y(t) = Y_0 + 1000t\vec{Y}$$
I will asssume $R_0, Y_0, \vec{R}, \vec{Y} \in \mathbb{R}^2$ by your drawing. If we want the yellow dot to collide with the red dot, we must satisfy
$$R_0 + 400\lambda \vec{R} = Y_0 + 1000\lambda\vec{Y}, \quad \lambda \in \mathbb{R}^+$$
$$ \Rightarrow R_{0_1} + 400\lambda r_1 = Y_{0_1} + 1000\lambda y_1 \text{ AND } R_{0_2} + 400\lambda r_2 = Y_{0_2} + 1000\lambda y_2$$ 
where I have used $R_0 = (R_{0_1}, R_{0_2}), Y_0 = (Y_{0_1}, Y_{0_2}), \vec{R} = (r_1, r_2), $ and $\vec{Y} = (y_1, y_2)$. Assuming that the red dot and yellow dot will collide before the red dot reaches the green dot, you just need to satisfy one of the above. Let us do it for the first component:
$$R_{0_1} + 400\lambda r_1 = Y_{0_1} + 1000\lambda y_1$$
$$\Rightarrow \frac{R_{0_1} - Y_{0_1}}{1000y_1 - 400r_1} = \lambda$$
We now know where the red and yellow dot will intercept. Therefore you just need to compute $x_Y(\lambda)$ and $x_R(\lambda)$ to get their intersection coordinates. Note though that $x_Y(\lambda) = x_R(\lambda)$ since they are colliding at time $\lambda$.
However, we must check when they collide. First let us calculate the time it takes for the red dot to collide with the green dot:
$$ \sqrt{\frac{(R_{0_1} - G_{0_1})^2 + (R_{0_2} - G_{0_2})^2}{r_1^2 + r_2^2}} = \lambda^\prime $$
Now we have the following situations:
$$ \lambda < 0  \text{   Red and yellow dot do not intersect}$$
$$ 0 \leq \lambda < \lambda^\prime \text{   The red and yellow dot collide before it hits the red}$$
$$ 0 \leq \lambda^\prime < \lambda \text{   The red and yellow dot collide after the red passes the green} $$
I will leave it up to you to fill out the missing code for calculating $\lambda^\prime$ and comparing the result to $\lambda$.
Relevant Matlab code:
//Returns the vector intersection where the red and yellow point collide
function intersection = getIntersection(r0, y0, R, Y) {
   lambda = (r0[1] - y0[1]) / (1000 * Y[1] - 400 * R[1]);
   intersection = (r0 + 400 * lambda * R );
}

