Большое переименование: замена префикса F на более корректный FP (Floating Point)
This commit is contained in:
parent
c66edd3432
commit
ebb0a73555
31 changed files with 483 additions and 483 deletions
|
|
@ -1,63 +0,0 @@
|
|||
|
||||
/*
|
||||
* Author: Andrey Pokidov
|
||||
* Date: 18 Nov 2024
|
||||
*/
|
||||
|
||||
namespace BGC
|
||||
{
|
||||
public class F32Turns
|
||||
{
|
||||
public static float ToRadians(float turns)
|
||||
{
|
||||
return turns * F32Radians.TWO_PI;
|
||||
}
|
||||
|
||||
public static float ToDegrees(float turns)
|
||||
{
|
||||
return turns * 360.0f;
|
||||
}
|
||||
|
||||
public static float ToUnits(float turns, AngleUnit toUnit)
|
||||
{
|
||||
if (toUnit == AngleUnit.RADIANS)
|
||||
{
|
||||
return turns * F32Radians.TWO_PI;
|
||||
}
|
||||
|
||||
if (toUnit == AngleUnit.DEGREES)
|
||||
{
|
||||
return turns * 360.0f;
|
||||
}
|
||||
|
||||
return turns;
|
||||
}
|
||||
|
||||
public static float Normalize(float turns, AngleRange range)
|
||||
{
|
||||
if (range == AngleRange.UNSIGNED_RANGE)
|
||||
{
|
||||
if (0.0f <= turns && turns < 1.0f)
|
||||
{
|
||||
return turns;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (-0.5f < turns && turns <= 0.5f)
|
||||
{
|
||||
return turns;
|
||||
}
|
||||
}
|
||||
|
||||
float rest = turns - MathF.Floor(turns);
|
||||
|
||||
if (range == AngleRange.SIGNED_RANGE && rest > 0.5f)
|
||||
{
|
||||
rest -= 1.0f;
|
||||
}
|
||||
|
||||
return rest;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue