这是在最好(最快)方式来计算两个向量垂直于所述第三矢量(X)和也彼此垂直?
What is the best (fastest) way to compute two vectors that are perpendicular to the third vector(X) and also perpendicular to each other?
这是我应该如何计算这个向量将现在:
This is how am I computing this vectors right now:
// HELPER - unit vector that is NOT parallel to X
x_axis = normalize(X);
y_axis = crossProduct(x_axis, HELPER);
z_axis = crossProduct(x_axis, y_axis);
我知道有解决这一无限多的,我不关心哪一个会是我的解决办法。
I know there is infinite number of solutions to this, and I don't care which one will be my solution.
这背后的问题:我需要构造变换矩阵,在那里我知道哪个方向应该X轴(矩阵第一列)被人指指点点。我需要计算Y和Z轴(第二和第三列)。正如我们所知,所有轴必须垂直于对方。
What is behind this question: I need to construct transformation matrix, where I know which direction should X axis (first column in matrix) be pointing. I need to calculate Y and Z axis (second and third column). As we know, all axes must be perpendicular to each other.
我做了什么,只要 X<> 0 或 Y'LT ;> 0
是
A = [-Y,X,0]
B = [-X * Z,Y * Z,X * X + Y * Y]
A = [-Y, X, 0]
B = [-X*Z, -Y*Z, X*X+Y*Y]
然后规范化载体。
[ X,Y,Z]·[-Y,X,0] = -X*Y+Y*X = 0
[ X,Y,Z]·[-X*Z,-Y*Z,X*X+Y*Y] = -X*X*Z-Y*Y*Z+Z*(X*X+Y*Y) = 0
[-Y,X,0]·[-X*Z,-Y*Z,X*X+Y*Y] = Y*X*Z+X*Y*Z = 0
这就是所谓的向量的零空间的。
如果 X = 0
和 Y = 0
然后 A = [1,0 ,0]
, B = [0,1,0]
。
上一篇:检查我的应用程序在运行Android我的、应用程序、Android
下一篇:Android的应用内结算V3没有返回正确的本地化价格(getSkuDetails)正确、价格、Android、getSkuDetails