Innovenergy_trunk/csharp/Lib/Units/Angle.cs

25 lines
538 B
C#

using DecimalMath;
using InnovEnergy.Lib.Units.Generator;
using InnovEnergy.Lib.Utils;
namespace InnovEnergy.Lib.Units;
[Sum]
public readonly partial struct Angle
{
public static String Unit => "rad";
public static String Symbol => "∠";
public static readonly Angle Pi = new Angle(DecimalEx.Pi);
public Angle(Decimal value)
{
var modulo = value.Modulo(DecimalEx.TwoPi);
Value = modulo > DecimalEx.Pi
? modulo - DecimalEx.TwoPi
: modulo;
}
}