public static void Main()
        {
            var scaledRectangle = new Size(5, 10);

            var scaledRectangleSize = Size.GetRotatedSize(scaledRectangle, 45);

            Console.WriteLine(scaledRectangleSize);
        }
Пример #2
0
        public static Size GetRotatedSize(Size size, double rotationAngle)
        {
            var cosOfRotationAgle = Math.Cos(rotationAngle);
            var sinOfRotationAngle = Math.Sin(rotationAngle);

            var absOfCos = Math.Abs(cosOfRotationAgle);
            var absOfSin = Math.Abs(sinOfRotationAngle);

            var result = new Size((absOfCos * size.width) + (absOfSin * size.height), (absOfSin * size.width) + (absOfCos * size.height));

            return result;
        }