我有以下代码行:我在不知道值(多少度)的情况下对矩形应用了一些旋转。现在我想在 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 度的角度