2f107db...5202af9

This commit is contained in:
Joonas Rikkonen
2019-03-18 21:42:26 +02:00
parent 58c92888b7
commit 044fd3344b
395 changed files with 27417 additions and 19754 deletions
@@ -200,6 +200,26 @@ namespace Barotrauma
return to - from;
}
/// <summary>
/// Returns the angle between the two angles, where the direction matters.
/// </summary>
public static float GetMidAngle(float from, float to)
{
float max = MathHelper.Max(from, to);
float min = MathHelper.Min(from, to);
float diff = max - min;
if (from < to)
{
// Clockwise
return from + diff / 2;
}
else
{
// CCW
return from - diff / 2;
}
}
/// <summary>
/// solves the angle opposite to side a (parameters: lengths of each side)
/// </summary>