Exemplo n.º 1
0
        public void TestPointDistanceStructFloatWithoutSquareRoot()
        {
            var pointOne = new PointStruct(10, 20);
            var pointTwo = new PointStruct(20, 55);

            PointDistanceWithoutSquareRoot(pointOne, pointTwo);
        }
Exemplo n.º 2
0
        public void TestPointDistanceStructDouble()
        {
            var pointOne = new PointStruct(10, 20);
            var pointTwo = new PointStruct(20, 55);

            PointDistanceDouble(pointOne, pointTwo);
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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)));
        }