/// <summary> /// get angle of two vector /// </summary> /// <param name="lhs">first vector</param> /// <param name="rhs">second vector</param> /// <returns> angle of two vector</returns> public static double GetAngleOf2Vectors(Vector lhs, Vector rhs, bool acuteAngleDesired) { double angle = Math.Acos(lhs.GetNormal() * rhs.GetNormal()); if (acuteAngleDesired && angle > Math.PI / 2) { angle = Math.PI - angle; } return(angle); }
/// <summary> /// get angle of two vector /// </summary> /// <param name="lhs">first vector</param> /// <param name="rhs">second vector</param> /// <returns> angle of two vector</returns> public static double GetAngleOf2Vectors(Vector lhs, Vector rhs, bool acuteAngleDesired) { double angle = Math.Acos(lhs.GetNormal() * rhs.GetNormal()); if (acuteAngleDesired && angle > Math.PI / 2) { angle = Math.PI - angle; } return angle; }