Change 'handedness' of a Row-major 4x4 transformation matrix

ant*_*nti 6 math transformation matrix

I have transformation and rotation coordinate data that is in a Row-major 4x4 transformation matrix format.

Ux Vx Wx Tx    
Uy Vy Wy Ty    
Uz Vz Wz Tz    
0  0  0  1
Run Code Online (Sandbox Code Playgroud)

The source of the data and the software that I need to send it to have different handed coordinate systems. One is left-handed, the other right.

How can I change the matrix from right to left handed and vice versa? I understand that for transformations you can just invert the Y axis, but for rotations it seems more complex.

Thanks.

Ste*_*non 10

您可以通过翻转 Y 轴在两个坐标系之间转换矢量。这相当于乘以矩阵:

F = [ 1  0  0  0 ]
    [ 0 -1  0  0 ]
    [ 0  0  1  0 ]
    [ 0  0  0  1 ]
Run Code Online (Sandbox Code Playgroud)

要在翻转的坐标空间中应用您的变​​换,您可以翻转 Y 轴,应用您的变​​换,然后再次翻转 Y 轴以返回原始坐标空间。写成矩阵乘法,这看起来像:

F*(M*(F*x))                [1]
Run Code Online (Sandbox Code Playgroud)

(其中 M 是您的矩阵)。好的,但那很浪费——现在我们有三个矩阵乘法而不是一个;幸运的是,矩阵乘法是结合的,所以我们重写:

F*(M*(F*x)) = (FMF)*x
Run Code Online (Sandbox Code Playgroud)

我们只需要计算矩阵 FMF。对角矩阵的左乘通过对角线上的相应元素缩放另一个矩阵的行;右乘缩放列。所以我们需要做的就是否定第二行和第二列:

FMF = [ Ux -Vx  Wx  Tx ]
      [-Uy  Vy -Wy -Ty ]
      [ Uz -Vz  Wz  Tz ]
      [  0   0   0   1 ]
Run Code Online (Sandbox Code Playgroud)

根据您的评论,听起来您实际上可能不想转换回原始坐标系,在这种情况下,您可以简单地使用矩阵 MF 而不是 FMF。

[1] 更一般地说,做一个变换,然后是一些操作,然后取消变换被称为共轭作用,它通常具有 F?¹MF 形式。碰巧我们的矩阵 F 是它自己的逆矩阵。