using System; namespace Microsoft.Msagl.Layout.MDS { /// /// Class for graoh layout with Multidimensional Scaling. /// static internal class Transform { /// /// Rotates a 2D configuration clockwise by a given angle. /// /// Coordinate vector. /// Coordinate vector. /// Angle between 0 and 360. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "y"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x")] public static void Rotate(double[] x, double[] y, double angle) { double sin = Math.Sin(angle * Math.PI / 180); double cos = Math.Cos(angle * Math.PI / 180); for (int i = 0; i < x.Length; i++) { double xNew = cos * x[i] + sin * y[i]; double yNew = cos * y[i] - sin * x[i]; x[i] = xNew; y[i] = yNew; } } } }