Большое переименование: замена префикса F на более корректный FP (Floating Point)

This commit is contained in:
Andrey Pokidov 2024-11-20 12:24:12 +07:00
parent c66edd3432
commit ebb0a73555
31 changed files with 483 additions and 483 deletions

63
BGC/FP32Turns.cs Normal file
View file

@ -0,0 +1,63 @@

/*
* Author: Andrey Pokidov
* Date: 18 Nov 2024
*/
namespace BGC
{
public class FP32Turns
{
public static float ToRadians(float turns)
{
return turns * FP32Radians.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 * FP32Radians.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;
}
}
}