Skip to main content
2 of 8
added 11 characters in body
cassepipe
  • 103
  • 1
  • 3

Given two vectors, find the rotation matrix between the two

So I am making a raytracer following the very helpful online book of Gabriel Gambettta but I stumble on the rotation matrix part.

My linear algebra background is 3Blue1Brown video series "The essence of Linear Algebra".

I simulate a camera placed at the origin that's looking forward ie whose direction is the vector {0,0,1}. Let's say I am given another normalized camera direction with direction {a,b,c}. From what I understand if I find the rotation matrix R that takes as an input {0,0,1} and spits out {a,b,c} as an output. I can apply that rotation matrix to all my rays in order to rotate them. I can't get my head around on how to find R. Any help/explanation/correction much welcome.

Thanks

cassepipe
  • 103
  • 1
  • 3