Переименование проектов и оптимизация вычислений / 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,63 +0,0 @@
|
|||
|
||||
/*
|
||||
* Author: Andrey Pokidov
|
||||
* Date: 18 Nov 2024
|
||||
*/
|
||||
|
||||
namespace BGC
|
||||
{
|
||||
public class FP64Turns
|
||||
{
|
||||
public static double TurnsToRadians(double turns)
|
||||
{
|
||||
return turns * FP64Radians.TWO_PI;
|
||||
}
|
||||
|
||||
public static double TurnsToDegrees(double turns)
|
||||
{
|
||||
return turns * 360.0;
|
||||
}
|
||||
|
||||
public static double ToUnits(double turns, AngleUnit toUnit)
|
||||
{
|
||||
if (toUnit == AngleUnit.RADIANS)
|
||||
{
|
||||
return turns * FP64Radians.TWO_PI;
|
||||
}
|
||||
|
||||
if (toUnit == AngleUnit.DEGREES)
|
||||
{
|
||||
return turns * 360.0;
|
||||
}
|
||||
|
||||
return turns;
|
||||
}
|
||||
|
||||
public static double Normalize(double turns, AngleRange range)
|
||||
{
|
||||
if (range == AngleRange.UNSIGNED_RANGE)
|
||||
{
|
||||
if (0.0 <= turns && turns < 1.0)
|
||||
{
|
||||
return turns;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (-0.5 < turns && turns <= 0.5)
|
||||
{
|
||||
return turns;
|
||||
}
|
||||
}
|
||||
|
||||
double rest = turns - Math.Floor(turns);
|
||||
|
||||
if (range == AngleRange.SIGNED_RANGE && rest > 0.5)
|
||||
{
|
||||
rest -= 1.0;
|
||||
}
|
||||
|
||||
return rest;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue