/// <summary> /// Returns a string describing the coordinates as a Lua table of format "{ x = <see cref="X"/>, y = <see cref="Y"/> }" /// </summary> /// <returns>A string</returns> public string ToLuaTable() { return($"{{ [\"x\"] = {Toolbox.ValToString(X)}, [\"y\"] = {Toolbox.ValToString(Y)} }}"); }
/// <summary> /// Interpolates two sets of coordinates. /// </summary> /// <param name="coo1">A set of coordinates</param> /// <param name="coo2">Another set of coordinates</param> /// <param name="value">A value between</param> /// <returns>The interpolated set of coordinates</returns> public static Coordinates Lerp(Coordinates coo1, Coordinates coo2, double value) { return(new Coordinates(Toolbox.Lerp(coo1.X, coo2.X, value), Toolbox.Lerp(coo1.Y, coo2.Y, value))); }
/// <summary> /// Creates a random coordinates set at a distance between minmax.Min and minMax.Max from the zero point. /// Mostly used to create random inaccuracy from waypoints, etc. /// </summary> /// <param name="minMax">Minimum and maximum distance from 0,0</param> /// <returns>A set of coordinates</returns> public static Coordinates CreateRandom(MinMaxD minMax) { return(FromAngleInDegrees(Toolbox.RandomDouble(360.0)) * minMax.GetValue()); }
/// <summary> /// Converts the coordinates to a string in the "X,Y" format in the invariant culture. /// </summary> /// <returns>A string</returns> public override string ToString() { return(Toolbox.ValToString(X) + "," + Toolbox.ValToString(Y)); }