public float ShortDistanceStruct(PointStructFloat pointOne, PointStructFloat pointTwo) { float x = pointOne.X - pointTwo.X; float y = pointOne.Y - pointTwo.Y; return((x * x) + (y * y)); }
public BechmarkClass() { Random random = new Random(); int[] vs = new int[20]; // должно быть кратно 4 for (int i = 0; i < vs.Length; i++) { vs[i] = random.Next(0, 50); } int length = vs.Length / 2; pointClasses = new PointClass[length]; pointStruct_Doubles = new PointStructDouble[length]; pointStruct_Floats = new PointStructFloat[length]; for (int i = 0; i < length; i++) { pointClasses[i] = new PointClass() { X = vs[i * 2], Y = vs[i * 2 + 1] }; pointStruct_Doubles[i] = new PointStructDouble() { X = vs[i * 2], Y = vs[i * 2 + 1] }; pointStruct_Floats[i] = new PointStructFloat() { X = vs[i * 2], Y = vs[i * 2 + 1] }; } }