Imprecision with rotation matrix to align a vector to an axis
问题 I've been banging my head against the wall with this for several hours and I can't seem to figure out what I'm doing wrong. I'm trying to generate a rotation matrix which will align a vector with a particular axis (I'll ultimately be transforming more data, so having the rotation matrix is important). I feel like my method is right, and if I test it on a variety of vectors, it works pretty well , but the transformed vectors are always a little off . Here's a full code sample I'm using to test