How to resize a vector to a specific length?

18.1k Views Asked by At

I have a 3D vector u defined through two points A (0/2/0) and B (3/3/3).

u        = [3/1/3]  
u.length = sqrt(3²+1²+3²) = 4.24...

How can I get a new vector v with v.length = 1.5 which has the same origin A and direction as u?

2

There are 2 best solutions below

0
On BEST ANSWER

In general, if you have a vector $\bf v$, and you want another vector in the same direction, with a given length $L$, then the vector: $${\bf u} = \frac{L}{\|{\bf v}\|} {\bf v}$$ does the job, because: $$\left\|{\bf u} \right\| = \left\| \frac{L}{\|{\bf v}\|} {\bf v} \right\| = \frac{L}{\|{\bf v}\|} \|{\bf v}\| = L $$

0
On

Don't forget to add in the coördinates of the origin.

$\left[{9\over{2\sqrt {19}}}/{{3+4\sqrt {19}}\over{2\sqrt {19}}}/{9\over{2\sqrt {19}}}\right]$