空间坐标变换(PythonC++实现) 空间坐标变换可看作坐标点乘以一个齐次矩阵,其中,齐次矩阵可表示为:其中:①区域的3×3矩阵产生三维图形的比例、对称、旋转、错切等基本变换;②区域产生图形的透视变换;③区域产生沿X、Y、Z三个轴的平移变换;④区域产生图形的总比例变换。平移变换平移变换可表示为:[xyz1][100001000010lmn1]=[x+ly+mz+n1] \begin{gathered} \quad \begin{bmatrix} x y z 1 \end{bmatrix} \begin{bmatrix} 1 0 0 0 \\ 0 1 0 0 \\ 0 0 1 0 \\ l m n 1 \end{bmatrix} = \begin{bmatrix} x+l y+m z+n 1 \end{bmatrix} \end{gathered}[x​y​z​1​]​100l​010m​001n​0001​​=[x+l​y+m​z+n​1​]​绕X轴旋转空间立体绕X轴旋转某个角度,实体上个点的X坐标不变,只有Y、Z坐标改变,可表示为:[xyz1][10000cos(θ)sin(θ)00−sin(θ)cos(θ)00001]=[xy×cos(θ)−z×sin(θ)y×sin(θ)+z×cos(θ)1] \begin{gathered} \quad \begin{bmatrix} x y z 1 \end{bmatrix} \begin{bmatrix} 1 0 0 0 \\ 0 cos(\theta) sin(\theta) 0 \\ 0 -sin(\theta) cos(\theta) 0 \\ 0 0 0 1 \end{bmatrix} = \begin{bmatrix} x y \times cos(\theta) - z \times sin(\theta) y \times sin(\theta) + z \times cos(\theta) 1 \end{bmatrix} \end{gathered}[x​y​z​1​]​1000​0cos(θ)−sin(θ)0​0sin(θ)cos(θ)0​0001​​=[x​y×cos(θ)−z×sin(θ)​y×