rotate matrix from 2 vectors

综合自己想的和能找到的方法大致如下,但是还是觉得比较繁琐:

vector v1;//both normalized
vector v2;
f32 angle = acos(dot(v1,v2));
vector v3 = cross(v1,v2);
v3.normalize();
//use angle&angle to make rotate matrix
CreateRotateMatrix(angle, v3);
 

如果见到有快速优雅的方法,请麻烦留个言告知下,谢谢。


原文链接: http://blog.csdn.net/ccanan/article/details/5826561

你可能感兴趣的:(rotate matrix from 2 vectors)