Calculates the distance from Point. - CSharp System

CSharp examples for System:Math Geometry

Description

Calculates the distance from Point.

Demo Code


using Windows.Foundation;
using System;//from  ww w .  j  a  va 2s .  c  om

public class Main{
        /// <summary>
        /// Calculates the distance.
        /// </summary>
        /// <param name="pointA">The point a.</param>
        /// <param name="pointB">The point b.</param>
        /// <returns>The distance.</returns>
        private static double Distance(this Point pointA, Point pointB)
        {
            double x = pointA.X - pointB.X;
            double y = pointA.Y - pointB.Y;
            return Math.Sqrt((x * x) + (y * y));
        }
}

Related Tutorials