2012-02-22 102 views

回答

7

齐次坐标:

  [ cos(theta) -sin(theta) 0 ] 
Rotate = [ sin(theta) cos(theta) 0 ] 
      [  0   0  1 ] 

      [ 1 0 x ] 
Translate = [ 0 1 y ] 
      [ 0 0 1 ] 

所以要执行转换,你乘Translate(x, y) * Rotate(theta) * Translate(-x, -y)并获得变换矩阵。

+0

用于写入的+1 – alecnash 2012-07-31 13:09:46

+1

您是否对旋转和x坐标偶然使用了相同的变量名? – SwiftsNamesake 2016-01-05 14:35:51

+0

不应该是T(x,y)* R * T(-x,-y)? – Dschoni 2017-01-11 13:30:52

1

或者在一个功能statment

Vector RotateAbout(Vector node, Vector center, double angle) 
{ 
    return new Vector(
     center.X + (node.X-center.X)*COS(angle) - (node.Y-center.Y)*SIN(angle), 
     center.Y + (node.X-center.X)*SIN(angle) + (node.Y-center.Y)*COS(angle) 
    }; 
}