现有一个矩形,位置在100,100,高宽都是100,我让它在它的中心(150,150)旋转了45°,请问我如何求它的4个顶点在原来坐标系的位置?
补充:未旋转时4个点是(100,100),(200,100),(100,200),(200,200)。

解决方案 »

  1.   


                Matrix m_Matrix
                m_Matrix = g.Transform;
                m_Matrix.Reset();
                m_Matrix.Translate(center.X, center.Y, MatrixOrder.Append);
                m_Matrix.Rotate(m_Angle);
                m_ScaleX = RealBound.Width > 0 ? 1 : -1;
                m_ScaleY = RealBound.Height > 0 ? 1 : -1;
                m_Matrix.Scale(m_ScaleX, m_ScaleY);
                m_Matrix.Shear(m_ShearX, m_ShearY);
                g.Transform = m_Matrix;
                g.TranslateTransform(-center.X, -center.Y);
                //绘图
                  g.ResetTransform();以上是我绘图的一个顺序,问题就是我不知道我旋转后的图形的各个坐标在原坐标系中的相对位置是多少,请教各位有没有什么方法或者是函数可以解决?