Example #1
0
        public static Size GetSizeRotated(Size originalSize, double rotationAngle)
        {
            double positiveCos = Math.Abs(Math.Cos(rotationAngle));
            double positiveSin = Math.Abs(Math.Sin(rotationAngle));
            double rotatedWidth = positiveCos * originalSize.Width + positiveSin * originalSize.Height;
            double rotatedHeight = positiveSin * originalSize.Width + positiveCos * originalSize.Height;
            Size rotatedSize = new Size (rotatedWidth, rotatedHeight);

            return rotatedSize;
        }
Example #2
0
        /// <summary>
        /// Gets rotated size with given size object and a given rotation angle.
        /// </summary>
        /// <param name="size">Input size object.</param>
        /// <param name="rotationAngle">Input rotation angle.</param>
        /// <returns>Returns the rotated size object.</returns>
        internal static Size GetRotatedSize(Size size, double rotationAngle)
        {
            double width = GetAbsoluteCos(rotationAngle, size.Width) +
                GetAbsoluteSin(rotationAngle, size.Height);
            double height = GetAbsoluteSin(rotationAngle, size.Width) +
                GetAbsoluteCos(rotationAngle, size.Height);

            Size rotatedSize = new Size(width, height);

            return rotatedSize;
        }