Beispiel #1
0
        /// <summary>
        /// Get the Perpendiculars distance.
        /// </summary>
        /// <param name="point1">The point1.</param>
        /// <param name="point2">The point2.</param>
        /// <param name="point">The point.</param>
        /// <returns></returns>
        /// <remarks>Created 2012-04-01</remarks>
        public static double PerpendicularDistance(SpeedyAStarNode point1, SpeedyAStarNode point2, SpeedyAStarNode point)
        {
            double area = Math.Abs(.5*(point1.X*point2.Y + point2.X*
                                                           point.Y + point.X*point1.Y - point2.X*point1.Y - point.X*
                                                                                                            point2.Y -
                                       point1.X*point.Y));
            double bottom = Math.Sqrt(Math.Pow(point1.X - point2.X, 2) +
                                      Math.Pow(point1.Y - point2.Y, 2));
            double height = area/bottom*2;

            return height;
        }
Beispiel #2
0
Datei: Legs.cs Projekt: ipo/AGBA
 public float GetDistance(SpeedyAStarNode node)
 {
     return GetDistance(node.X, node.Y, ZetaDia.Me.Position.X, ZetaDia.Me.Position.Y);
 }