/// <summary> /// Calc angle from position to to position via <code>Math.Atan2</code> /// </summary> /// <param name="fromX"></param> /// <param name="fromY"></param> /// <param name="toX"></param /// <param name="toY"></param> /// <see cref="Math.Atan2"/> /// <see cref="AngleUtils.AngleDegree"/> /// <returns>angle in degree</returns> public static double AngleDegree(double fromX, double fromY, double toX, double toY) { return(AngleUtils.AngleDegree(fromX, fromY, toX, toY)); }
/// <summary> /// Normalize angle in rads to be from 0 to 2PI. /// </summary> /// <param name="rads">Normalized angle in rads</param> /// <returns>Normalized angle.</returns> public static double NormalizeAngle(double rads) { return(AngleUtils.NormalizeAngle(rads)); }
/// <summary> /// Calc angle from position to to position via <code>Math.Atan2</code> /// </summary> /// <param name="from"></param> /// <param name="to"></param /// <see cref="Math.Atan2"/> /// <see cref="AngleUtils.AngleDegree"/> /// <returns>angle in degree</returns> public static double AngleDegree(Point from, Point to) { return(AngleUtils.AngleDegree(from.X, from.Y, to.X, to.Y)); }
/// <summary> /// Convert angle in rads to angle in degree. /// </summary> /// <param name="rads">Converted angle in rads.</param> /// <returns>Return angle in degree.</returns> public static double ToDegree(double rads) { return(AngleUtils.ToDegree(rads)); }
/// <summary> /// Convert angle in degree to angle in rads. /// </summary> /// <param name="degree">Converted angle in degree.</param> /// <returns>Return angle in rads</returns> public static double ToRads(double degree) { return(AngleUtils.ToRads(degree)); }
/// <summary> /// Normalize angle in degree to be from 0 to 360°. /// </summary> /// <param name="degree">Normalized angle in degree</param> /// <returns>Normalized angle.</returns> public static double NormalizeDegree(double degree) { return(AngleUtils.NormalizeAngle(degree)); }
/// <summary> /// Get robots horizontal speed. /// </summary> /// <param name="r"></param> /// <returns>Robot's horizontal speed</returns> public static double GetSpeedY(Robot r) { return(r.Power * r.Motor.MAX_SPEED / 100.0 * Math.Sin(AngleUtils.ToRads(r.AngleDrive))); }