How to align a vector to another one?

311 Views Asked by At

I have a given vector (a surface normal), and a second vector (pointing up). How would i have to manipulate the second vector, to make it point in the same direction as my surface vector? example:

surface $vec_3(0, 0, 1)$;

second $vec_3 (0, 0.8, 0.3)$;

result $vec_3(0, 0.3, 0.8)$;

basically have my second vectors $y$-axis aligned with my surface vector.

here is an example image: https://i.stack.imgur.com/mAWZX.jpg