我有以下的代码行: 在不知道旋转角度的情况下,我已经对矩形应用了一些旋转。现在我想要获取2D元素的旋转或者角度。
Rectangle element = (Rectangle)sender;
MatrixTransform xform = element.RenderTransform as MatrixTransform;
Matrix matrix = xform.Matrix;
third.Content = (Math.Atan(matrix.M21 / matrix.M22)*(180/Math.PI)).ToString();
and the matrix is like following
|M11 M12 0|
|M21 M22 0|
|dx dy 1| which is Transformation Matrix I guess !!
这个值似乎不正确。 我想要在0到360度之间获得角度。