2f107db...5202af9
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user