将变换矩阵拆分为正交矩阵和尺度矩阵
如果我有一个来自缩放、平移和旋转变换的矩阵。我想把这个矩阵分成两个矩阵。一种是旋转+平移矩阵,另一种是缩放矩阵。
因为我想计算正确的法线向量变换,所以我只需要正交矩阵来计算表面法线向量
有什么想法吗?
If I have a matrix from scale, translate, and rotation transform. I want to split this matrix to two matrix. One is rotation+translation matrix, the other is scale matrix.
Because I want to compute the correct normal vector transform, so I only need orthogonal matrix to do the computation for surface normal vector
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我假设你所说的这个矩阵是一个 4x4 矩阵,被一些人广泛使用,另一些人广泛鄙视,第四行是 0,0,0,1。
我将导致这两个操作“缩放”和“旋转+平移”。请注意:这些操作不可交换。缩放 3 向量,然后旋转/平移该缩放向量会产生与颠倒运算顺序所得到的结果不同的结果。
情况1,操作为“旋转+平移”,然后“缩放”。
令 SR=S*R,其中 S 是具有正对角线元素的 3x3 对角矩阵(缩放矩阵),R 是 3x3 正交旋转矩阵。矩阵 SR 的行将彼此正交,但列将不正交。比例因子是矩阵 SR 的行范数的平方根。
算法:
给定 4x4 矩阵 A,生成 4x4 缩放矩阵 S、4x4 旋转+平移矩阵 T
情况2,操作为“缩放”,然后“旋转+平移”。
现在考虑RS=R*S 的情况。这里 A 的列将彼此正交,但行将不正交。在这种情况下,比例因子是矩阵 RS 的列范数的平方根。
算法:
给定 4x4 矩阵 A,生成 4x4 旋转+平移矩阵 T、4x4 缩放矩阵 S
如果缩放不均匀(例如,将 x 缩放 2、y 缩放 4、z 缩放 1/2),您可以通过查看上面 3x3 矩阵的行和列与 1 的内积来判断运算顺序。其他。最后缩放(我的情况 1)意味着行内积将非常接近于零,但列内积将不为零。首先扩展(我的案例 2)可以扭转这种情况。如果缩放是均匀的,则无法区分哪种情况。你需要提前知道。
I'm assuming this matrix you are talking about is a 4x4 matrix that is widely used by some, widely despised by others, with the fourth row being 0,0,0,1.
I'll cause these two operations "scale" and "rotate+translate". Note well: These operations are not commutative. Scaling a 3-vector and then rotating/translating this scaled vector yields a different result than you would get by reversing the order of operations.
Case 1, operation is "rotate+translate", then "scale".
Let SR=S*R, where S is a 3x3 diagonal matrix with positive diagonal elements (a scaling matrix) and R is a 3x3 orthonormal rotation matrix. The rows of matrix SR will be orthogonal to one another, but the columns will not be orthogonal. The scale factors are the square root of the norms of the rows of the matrix SR.
Algorithm:
Given 4x4 matrix A, produce 4x4 scaling matrix S, 4x4 rotation+translation matrix T
Case 2, operation is "scale", then "rotate+translate".
Now consider the case RS=R*S. Here the columns of A will be orthogonal to one another, but the rows will not be orthogonal. In this case the scale factors are the square root of the norms of the columns of the matrix RS.
Algorithm:
Given 4x4 matrix A, produce 4x4 rotation+translation matrix T, 4x4 scaling matrix S
If the scaling is not uniform (e.g., scale x by 2, y by 4, z by 1/2), you can tell the order of operations by looking at the inner products of the rows and columns of the upper 3x3 matrix with one another. Scaling last (my case 1) means the row inner products will be very close to zero but the column inner products will be non zero. Scaling first (my case 2) reverses the situation. If the scaling is uniform there is no way to tell which case is which. You need to know beforehand.
只是一个想法 -
(1/sqrt(3),1/sqrt(3),1/sqrt(3))
,Just an idea -
(1/sqrt(3),1/sqrt(3),1/sqrt(3))
,