Переименование проектов и оптимизация вычислений / Renaming of projects and optimization of computations
This commit is contained in:
parent
37d86bc4c1
commit
75e5c02609
36 changed files with 177 additions and 379 deletions
|
|
@ -1,68 +0,0 @@
|
|||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue