Esempio n. 1
0
        /// <summary>
        /// Calculates the distance between 2 points, using x, y, and z coordinates
        /// </summary>
        /// <param name="ptA">The first point</param>
        /// <param name="ptB">The second point</param>
        /// <param name="units">Units of the value to return</param>
        /// <returns>The distance between ptA and ptB, using x, y, and z coordinates, using the specified units</returns>
        public static double CalculateDistance(API.Data.Point ptA, API.Data.Point ptB, Units units)
        {
            switch (units)
            {
            case Units.Feet:
                return(CalcUtil.CalculateDistance(ptA, ptB) / 12.0);

            case Units.Meters:
                return(CalcUtil.CalculateDistance(ptA, ptB) / 39.3701);

            case Units.TimeDistance:
                return(CalcUtil.CalculateTimeDistance(CalcUtil.CalculateDistance(ptA, ptB)));

            default:
                return(0);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Converts a given mumble-link Point to a map position.
 /// Note: mumble-link is in meters, while map position is in inches
 /// </summary>
 /// <param name="mumbleLinkPoint">The mumble link point to convert</param>
 /// <returns>The point in Map-Coordinates</returns>
 public static API.Data.Point ConvertToMapPosition(API.Data.Point mumbleLinkPoint)
 {
     return(new API.Data.Point(mumbleLinkPoint.X * MapConversionFactor,
                               mumbleLinkPoint.Y * MapConversionFactor,
                               mumbleLinkPoint.Z * MapConversionFactor));
 }
Esempio n. 3
0
 /// <summary>
 /// Calculates the distance between 2 points, using x, y, and z coordinates
 /// </summary>
 /// <param name="ptA">The first point</param>
 /// <param name="ptB">The second point</param>
 /// <returns>The distance between ptA and ptB, using x, y, and z coordinates</returns>
 public static double CalculateDistance(API.Data.Point ptA, API.Data.Point ptB)
 {
     // Note: Removing inclusion of the Z component, since it seems like the resulting distance isn't accurate in the game (might be a problem with the Z axis reported by the game)
     //return Math.Sqrt(Math.Pow(Math.Abs((ptB.X - ptA.X)), 2) + Math.Pow(Math.Abs((ptB.Y - ptA.Y)), 2) + Math.Pow(Math.Abs((ptB.Z - ptA.Z)), 2));
     return(Math.Sqrt(Math.Pow(Math.Abs((ptB.X - ptA.X)), 2) + Math.Pow(Math.Abs((ptB.Y - ptA.Y)), 2)));
 }
Esempio n. 4
0
 public static Vector CreateVector(API.Data.Point pt1, API.Data.Point pt2)
 {
     return(new Vector(pt2.X - pt1.X, pt2.Y - pt1.Y, pt2.Z - pt1.Z));
 }