private double PointDistanceD(PointStructOne pointOne, PointStructTwo pointTwo) { double x = pointOne.pX - pointTwo.pX; double y = pointOne.pY - pointTwo.pY; return(Math.Sqrt((x * x) + (y * y))); }
private float PointDistanceNoSqrt(PointStructOne pointOne, PointStructTwo pointTwo) { float x = pointOne.X - pointTwo.X; float y = pointOne.Y - pointTwo.Y; return((x * x) + (y * y)); }
private void SetArrays() { int size = 100; _arrayForPointClassOne = new PointClassOne[size]; _arrayForPointClassTwo = new PointClassTwo[size]; _arrayForPointStructOne = new PointStructOne[size]; _arrayForPointStructTwo = new PointStructTwo[size]; _arrayForPointStructOneD = new PointStructOne[size]; _arrayForPointStructTwoD = new PointStructTwo[size]; for (int i = 0; i < _arrayForPointStructOne.Length; i++) { _arrayForPointClassOne[i] = new PointClassOne() { X = (float)_random.NextDouble(), Y = (float)_random.NextDouble() }; _arrayForPointClassTwo[i] = new PointClassTwo() { X = (float)_random.NextDouble(), Y = (float)_random.NextDouble() }; _arrayForPointStructOne[i] = new PointStructOne() { X = (float)_random.NextDouble(), Y = (float)_random.NextDouble() }; _arrayForPointStructTwo[i] = new PointStructTwo() { X = (float)_random.NextDouble(), Y = (float)_random.NextDouble() }; _arrayForPointStructOneD[i] = new PointStructOne() { pX = _random.NextDouble(), pY = _random.NextDouble() }; _arrayForPointStructTwoD[i] = new PointStructTwo() { pX = _random.NextDouble(), pY = _random.NextDouble() }; } }