프로젝트

일반

사용자정보

개정판 f3ab410f

IDf3ab410f8451624fda6c768a806a4cf023b5ba10
상위 8de55603
하위 39f208de

김태성이(가) 약 4년 전에 추가함

markus 화살표텍스트박스 수정

Change-Id: Ia91a1979b4dbc5c612e44372eeff654eb48d8fd8

차이점 보기:

KCOM/Common/MathHelper.cs
33 33

  
34 34
        public static double ConvertToRadians(double angle)
35 35
        {
36
            return (Math.PI / 180) * angle;
36
            return (Math.PI / 360) * angle;
37 37
        }
38 38

  
39
        public static Rect RotateRect(Rect rect,double angle)
39
        public static Rect RotateRect(Rect rect,Point Center,double angle)
40 40
        {
41
            Rect result = rect;
41
            Rect rotateRect = rect;
42 42

  
43
            Point[] cornerPoints = { rect.TopLeft, rect.TopRight, rect.BottomRight, rect.BottomLeft };
44
            var m = new Matrix();
45
            //define rotation around rect center
46
            m.RotateAt(45.0, rect.X + rect.Width / 2.0, rect.Y + rect.Height / 2.0);
43
            var centerPoint = new Point(rect.X,rect.Y);
44
            var rotationCenter = RotatePoint(centerPoint, Center, angle);
47 45

  
48
            //transform corner points
49
            m.Transform(cornerPoints);
46
            if (angle == 270 || angle == 90)
47
            {
48
                rotateRect = new Rect(0,0, rect.Height, rect.Width);
49
            }
50
            else
51
            {
52
                rotateRect = new Rect(0,0, rect.Width, rect.Height);
53
            }
50 54

  
51
            result = new Rect(cornerPoints[0], cornerPoints[2]);
55
            rotateRect.X = rotationCenter.X;
56
            rotateRect.Y = rotationCenter.Y;
52 57

  
53
            return result;
58
            return rotateRect;
54 59
        }
55

  
56 60
    }
57 61
}

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)