TITLE: How to resize a vector to a specific length?
QUESTION [11 upvotes]: 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?

REPLY [16 votes]: 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 $$