public static Size GetRotatedSize(Size size, double rotatedAngle)
        {
            double rotatedWidth = Math.Abs(Math.Cos(rotatedAngle)) * size.width + Math.Abs(Math.Sin(rotatedAngle)) * size.heigth;
            double rotatedHeigth = Math.Abs(Math.Sin(rotatedAngle)) * size.width + Math.Abs(Math.Cos(rotatedAngle)) * size.heigth;
            Size newRotatedSize = new Size(rotatedWidth, rotatedHeigth);

            return newRotatedSize;
        }
示例#2
0
        public static Size GetRotatedSize(Size size, double angle)
        {
            double cos = Math.Abs(Math.Cos(angle));
            double sin = Math.Abs(Math.Sin(angle));
            double width = (cos * size.Width) + (sin * size.Height);
            double height = (sin * size.Width) + (cos * size.Height);
            Size sizeOfFigure = new Size(width, height);

            return sizeOfFigure;
        }
        public static Size GetRotatedFigure(Size s, double angleOfTheFigure)
        {
            var rotatedWidth = (Math.Abs(Math.Cos(angleOfTheFigure)) * s.width) +
                    (Math.Abs(Math.Sin(angleOfTheFigure)) * s.heigth);

            var rotatedHeigth = (Math.Abs(Math.Sin(angleOfTheFigure)) * s.width) +
                    (Math.Abs(Math.Cos(angleOfTheFigure)) * s.heigth);

            return new Size(rotatedWidth, rotatedHeigth);
        }
示例#4
0
        static void Main()
        {
            double width = 10.5;
            double height = 5.5;
            double angle = 35;

            Size triangle = new Size(width, height);
            Console.WriteLine("This figure has width {0} and height {1}", triangle.Width, triangle.Height);

            triangle = Size.GetRotatedSize(triangle, angle);
            Console.WriteLine("After rotated figure has width {0} and height {1}", triangle.Width, triangle.Height);
        }