AStarCollisionMap.PathfindingUtil.GetSquaredHypoteneuseLength C# (CSharp) 메소드

GetSquaredHypoteneuseLength() 공개 정적인 메소드

Gets the length of the hypoteneuse between two points, squared (without root multiplication)
public static GetSquaredHypoteneuseLength ( Point p1, Point p2 ) : double
p1 Point Point 1
p2 Point Point 2
리턴 double
        public static double GetSquaredHypoteneuseLength(Point p1, Point p2)
        {
            int xDiff = Math.Abs(p1.X - p2.X);
            int yDiff = Math.Abs(p1.Y - p2.Y);
            return Math.Pow(xDiff, 2) + Math.Pow(yDiff, 2);
        }