Basically, the question is about finding the rotation matrix that can align one set of 3D vectors as perpendicular as possible to another set of vectors.
My gut feeling is that there should be a closed-form solution, e.g., using SVD or the property of trace... Is there anyone who knows a closed-form solution to this problem (or an idea)?