仿射变换

仿射变换 得概念如何理解?

几个名字先熟悉一下:

  • 线性变换 linear transformation
  • 平移 translate
  • 旋转 rotate
  • 仿射变换 affine transformation
  • 缩放 scale
  • 剪切 shear
  • 透视变换 perspective transformation

矩阵相关名词:

  • identity matrix 单位矩阵
  • non-singular matrix 可逆矩阵(非奇异矩阵)
  • matrix’s determinant 矩阵行列式

Qt 相关对象

  • QMatrix
  • QTransform

 

QMatrix 结构

QMatrix::QMatrix(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy)
m11 m12 0
m21 m22 0
dx dy 1
  • dx ,dy     :    水平和垂直平移
  • m11, m22 : 水平和垂直缩放
  • m21, m12 : 水平和垂直剪切
x' = m11*x + m21*y + dx
y' = m22*y + m12*x + dy
      QMatrix translationMatrix(1, 0, 0, 1, 50.0, 50.0);
      QMatrix rotationMatrix(cosa, sina, -sina, cosa, 0, 0);
      QMatrix scalingMatrix(0.5, 0, 0, 1.0, 0, 0);

      QMatrix matrix;
      matrix =  scalingMatrix * rotationMatrix * translationMatrix;

QTransform 结构

 

延伸阅读

  • https://en.wikipedia.org/wiki/Affine_transformation
  • 为什么可逆矩阵又叫“非奇异矩阵(non-singular matrix)”
    https://www.cnblogs.com/marsggbo/p/10034629.html

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.