Innovenergy_trunk/csharp/Lib/Units/Angle.cs

25 lines
543 B
C#
Raw Normal View History

using DecimalMath;
2023-02-26 14:39:55 +00:00
using InnovEnergy.Lib.Units.Generator;
using InnovEnergy.Lib.Utils;
namespace InnovEnergy.Lib.Units;
[Generate]
2023-02-26 14:39:55 +00:00
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;
}
2023-02-26 14:39:55 +00:00
}