public static void Main() 
        {
            Size size = new Size(3, 4);
            Console.WriteLine(size);

            size = SizeRotation.GetRotatedSize(size, 90);
            Console.WriteLine(size);
        }
Exemple #2
0
        public static Size GetRotatedSize(Size currentSize, double angleInRadians)
        {
            double newWidth = GetRotatedDimension(angleInRadians, currentSize.Width);
            double newHeight = GetRotatedDimension(angleInRadians, currentSize.Height);

            Size result = new Size(newWidth, newHeight);

            return result;
        }
        public static Size GetRotatedSize(Size currentSize, double angleOfFigure)
        {
            double rotatedWidth = (Math.Abs(Math.Cos(angleOfFigure)) * currentSize.Width) +
                (Math.Abs(Math.Sin(angleOfFigure)) * currentSize.Height);
            double rotatedHeight = (Math.Abs(Math.Sin(angleOfFigure)) * currentSize.Width) +
                (Math.Abs(Math.Cos(angleOfFigure)) * currentSize.Height);

            return new Size(rotatedWidth, rotatedHeight);
        }
Exemple #4
0
        /// <summary>
        /// The method calculates the new size after rotating it by predefined degrees
        /// </summary>
        /// <param name="angleOfRotation">The angle of rotation.</param>
        /// <returns>New object of type Size.</returns>
        public Size GetRotatedSize(double angleOfRotation)
        {
            double cosRotation = Math.Cos(angleOfRotation);
            double sinRotation = Math.Sin(angleOfRotation);

            var width = (Math.Abs(cosRotation) * this.Width) + (Math.Abs(sinRotation) * this.Height);
            var height = (Math.Abs(sinRotation) * this.Width) + (Math.Abs(cosRotation) * this.Height);

            Size rotatedSize = new Size(width, height);
            return rotatedSize;
        }
 public static Size GetRotatedSize(Size initialSize, double angleOfTheFigure)
 {
     double newCosWidthSize = Math.Abs(Math.Cos(angleOfTheFigure)) * initialSize.Width;
     double newSinHeigthSize = Math.Abs(Math.Sin(angleOfTheFigure)) * initialSize.Heigth;
     double newSinWidthSize = Math.Abs(Math.Sin(angleOfTheFigure)) * initialSize.Width;
     double newCosHeigthSize = Math.Abs(Math.Cos(angleOfTheFigure)) * initialSize.Heigth;
     double fullWidthSize = newCosWidthSize + newSinWidthSize;
     double fullHeightSize = newCosHeigthSize + newSinHeigthSize;
     Size newSize = new Size(fullWidthSize, fullHeightSize);
     return newSize;
 }
Exemple #6
0
        public static Size GetRotatedSize(
            Size oldSize, double rotationAngel)
        {
            double oldWidth = oldSize.Width;
            double oldHeigth = oldSize.Heigth;
            var cos = Math.Cos(rotationAngel);
            var sin = Math.Sin(rotationAngel);

            var newWidth = Math.Abs((cos * oldWidth) + (sin * oldHeigth));
            var newHeigth = Math.Abs((sin * oldWidth) + (cos * oldHeigth));

            var roatedSize = new Size(newWidth, newHeigth);
            return roatedSize;
        }
Exemple #7
0
 public static Size GetRotatedSize(Size size, double angleOfFigure)
 {
     return new Size(Math.Abs(Math.Cos(angleOfFigure)) * size.width + Math.Abs(Math.Sin(angleOfFigure)) * size.height,
                     Math.Abs(Math.Sin(angleOfFigure)) * size.width + Math.Abs(Math.Cos(angleOfFigure)) * size.height);
 }