コード例 #1
0
ファイル: BenchmarkClass.cs プロジェクト: orlfi/GeekBrains
 public void BechmarkClassFloat()
 {
     for (int i = 0; i < SIZE - 1; i++)
     {
         PointClassFloat.PointDistance(pointClassFloatArray[i], pointClassFloatArray[i + 1]);
     }
 }
コード例 #2
0
ファイル: PointClassFloat.cs プロジェクト: orlfi/GeekBrains
        public static float PointDistance(PointClassFloat pointOne, PointClassFloat pointTwo)
        {
            float x = pointOne.X - pointTwo.X;
            float y = pointOne.Y - pointTwo.Y;

            return(MathF.Sqrt((x * x) + (y * y)));
        }
コード例 #3
0
ファイル: BenchmarkClass.cs プロジェクト: orlfi/GeekBrains
        public BenchmarkClass()
        {
            Random rnd = new Random();

            for (int i = 0; i < SIZE; i++)
            {
                int x = rnd.Next(1, 100);
                int y = rnd.Next(1, 100);
                pointClassFloatArray[i]   = new PointClassFloat(x, y);
                pointStructFloatArray[i]  = new PointStructFloat(x, y);
                pointStructDoubleArray[i] = new PointStructDouble(x, y);
            }
        }