/// <summary> /// Calculate d side. /// </summary> /// <param name="ad">AD angle in degrees.</param> /// <param name="ax">Lenth of side a_x.</param> /// <param name="bx">Lenth of side b_x.</param> /// <returns></returns> private static double CalculateD(double ad, double ax, double bx) { Checks.Between(ad, -90, 180, nameof(ad)); Checks.GreaterThanZero(ax, nameof(ax)); Checks.GreaterThanZero(bx, nameof(bx)); if (ad < 90) { var d = bx + ax; return(Math.Abs(d)); } else if (ad == 90) { var d = bx; return(Math.Abs(d)); } else // alpha > 90 { var d = bx - ax; return(Math.Abs(d)); } }
/// <summary> /// Calculate c side. /// </summary> /// <param name="cb">CB angle in degrees.</param> /// <param name="ay">Lenth of side a_y.</param> /// <param name="by">Lenth of side b_y.</param> /// <returns></returns> private static double CalculateC(double cb, double ay, double by) { Checks.Between(cb, -90, 180, nameof(cb)); Checks.GreaterThanZero(ay, nameof(ay)); Checks.GreaterThanZero(by, nameof(by)); if (cb < 90) { var c = ay + by; return(Math.Abs(c)); } else if (cb == 90) { var c = ay; return(Math.Abs(c)); } else // beta > 90 { var c = ay - by; return(Math.Abs(c)); } }