0
$\begingroup$

I have point $A$ which is traveling towards point $B$. Both points have $x,y,z$ coordinates. Point $A$ has a speed. For a given time period how much would I add to the $x,y,z$ coordinates of $A$ in order to make it travel at that speed?

Multiplying speed by the time would give me the distance traveled. I assume I could use trig to figure out all the distances that need to be added to $x$, $y$, and $z$. But, I get the feeling that there is a more efficient way to use matrices for this.

There's also the issue of overshooting point $B$ during any given time period, but I can just prevent that by getting the distance between the points and determining how much the distance traveled overshoots.

  • 0
    Note that Arturo's and Ross's answers are more or less the same... :)2011-08-29

2 Answers 2

1

If $A=(a_1,a_2,a_3)$ and $B=(b_1,b_2,b_3)$, then let $C=(b_1-a_1,b_2-a_2,b_3-a_3)$, and let $\mathbf{u}=C/\lVert C\rVert$ be the unit vector in the direction of $C$.

The function $A + t\mathbf{u}$ parametrizes the line through $A$ and $B$; and has value $A$ when $t=0$ and value $B$ when $t = \lVert C\rVert$; the derivative is $\mathbf{u}$, and thus the speed (which is the size of the velocity) is given by $\lVert u\rVert = 1$. To get it to be $s$, the speed you want, you just need to take $s\mathbf{u}$ instead of $\mathbf{u}$. So the function you want is $A + st\left(\frac{B-A}{\lVert B-A\rVert}\right),$ where the variable is $t$.

  • 0
    @HappyEngineer: Indeed! Sorry about the transposition. Yes, the double vertical bars are the (Euclidean norm) of the vector.2011-08-29
1

If the coordinates of $A$ are $(x_a,y_a,z_a)$, those of $B$ are $(x_b,y_b,z_b)$ and you want to arrive at time $t_0$, the coordinates at time $t$ are $(x_a+\frac{t}{t_0}(x_b-x_a),y_a+\frac{t}{t_0}(y_b-y_a),z_a+\frac{t}{t_0}(z_b-z_a))$. To get $t_0$ if you have speed $s$, you have $t_0=\sqrt{(x_b-x_a)^2+(y_b-y_a)^2+(z_b-z_a)^2}/s$. Not a trig function in sight.