Пример #1
0
        public void TestPointDistanceStructFloatWithoutSquareRoot()
        {
            var pointOne = new PointStruct(10, 20);
            var pointTwo = new PointStruct(20, 55);

            PointDistanceWithoutSquareRoot(pointOne, pointTwo);
        }
Пример #2
0
        public void TestPointDistanceStructDouble()
        {
            var pointOne = new PointStruct(10, 20);
            var pointTwo = new PointStruct(20, 55);

            PointDistanceDouble(pointOne, pointTwo);
        }
Пример #3
0
        private static double PointDistanceDouble(PointStruct pointOne, PointStruct pointTwo)
        {
            double x = pointOne.X - pointTwo.X;
            double y = pointOne.Y - pointTwo.Y;

            return(Math.Sqrt((x * x) + (y * y)));
        }
Пример #4
0
        private static float PointDistanceWithoutSquareRoot(PointStruct pointOne, PointStruct pointTwo)
        {
            float x = pointOne.X - pointTwo.X;
            float y = pointOne.Y - pointTwo.Y;

            return((x * x) + (y * y));
        }
Пример #5
0
        private static float PointDistance(PointStruct pointOne, PointStruct pointTwo)
        {
            float x = pointOne.X - pointTwo.X;
            float y = pointOne.Y - pointTwo.Y;

            return(MathF.Sqrt((x * x) + (y * y)));
        }