空間中3D對象的旋轉矩陣


4

這是下面的後續問題:Minimum requirements to uniquely represent a 3D object in space

假設我在3D對象(在3D空間)中有3個原始點,分別為A1=<xa,ya,za>A2=<xa,ya,za>A3=<xa,ya,za>(假定我們具有上一個問題中提到的所有要求)。3D對像在3D空間中移動和旋轉,新的目標點變為B1=<xb,yb,zb>B2=<xb,yb,zb>B3=<xb,yb,zb>

轉換矩陣的公式是什麼?基本上,我需要一個矩陣,如果將其應用於原點對象的所有點,則可以得到置換的對象。

2

Skimming the math. Starting with a quaternion $Q=w+\left(x,y,z\right)$ then we can rotate $\mathbf{v}$ by:

$$\mathbf{v}' = Q\mathbf{v}Q^{-1}$$

and if $Q$ is unit magnitude this reduces to:

$$\mathbf{v}' = Q\mathbf{v}Q^*$$

To create a matrix we need to apply the rotation to the basis set to form our three equations:

$$ \mathbf{x} = \left(1,0,0\right) \\ \mathbf{y} = \left(0,1,0\right) \\ \mathbf{z} = \left(0,0,1\right) \\ $$

which expanded and reduced gives:

$$ \mathbf{x}' = Q\mathbf{x}Q^{-1} = \left(1 - 2 \left(y^2+z^2\right), 2\left(xy+wz\right), 2\left(xz-wy\right) \right) \\ \mathbf{y}' = Q\mathbf{y}Q^{-1} = \left(2 \left(xy-wz\right), 1 - 2\left(x^2+z^2\right), 2\left(wx+yz\right) \right) \\ \mathbf{z}' = Q\mathbf{z}Q^{-1} = \left(2 \left(wy+xz\right), 2\left(yz-wx\right), 1 - 2\left(x^2+y^2\right) \right) $$

Sticking to the math convention of column vectors, then we shove the three equations into the first three columns and to add a translation by $\left(t_x,t_y,t_z\right)$ we shove that into the last column giving:

$$ { \left( \begin{array}{ccc} 1 - 2 \left(y^2+z^2\right) & 2\left(xy-wz\right) & 2\left(xz+wy\right) & t_x\\ 2 \left(xy+wz\right) & 1 - 2\left(x^2+z^2\right) & 2\left(wx-yz\right) & t_y \\ 2 \left(wy-xz\right) & 2\left(yz+wx\right) & 1 - 2\left(x^2+y^2\right) & t_z \\ 0 & 0 & 0 & 1 \end{array} \right) } $$