Большое переименование: замена префикса 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

68
BGC/FP32Degrees.cs Normal file
View file

@ -0,0 +1,68 @@

/*
* Author: Andrey Pokidov
* Date: 18 Nov 2024
*/
namespace BGC
{
public class FP32Degrees
{
public const float RADIANS_IN_DEGREE = 1.745329252E-2f;
public const float TURNS_IN_DEGREE = 2.7777777778E-3f;
public static float ToRadians(float degrees)
{
return degrees * RADIANS_IN_DEGREE;
}
public static float ToTurns(float degrees)
{
return degrees * TURNS_IN_DEGREE;
}
public static float ToUnits(float degrees, AngleUnit toUnit)
{
if (toUnit == AngleUnit.RADIANS)
{
return degrees * RADIANS_IN_DEGREE;
}
if (toUnit == AngleUnit.TURNS)
{
return degrees * TURNS_IN_DEGREE;
}
return degrees;
}
public static float Normalize(float radians, AngleRange range)
{
if (range == AngleRange.UNSIGNED_RANGE)
{
if (0.0f <= radians && radians < 360.0f)
{
return radians;
}
}
else
{
if (-180.0f < radians && radians <= 180.0f)
{
return radians;
}
}
float turns = radians * TURNS_IN_DEGREE;
turns -= MathF.Floor(turns);
if (range == AngleRange.SIGNED_RANGE && turns > 0.5f)
{
turns -= 1.0f;
}
return turns * 360.0f;
}
}
}