Innovenergy_trunk/csharp/Lib/Units/Angle.cs

20 lines
422 B
C#

using InnovEnergy.Lib.Units.Generator;
using static System.Math;
namespace InnovEnergy.Lib.Units;
[Generate]
public readonly partial struct Angle
{
public static String Unit => "rad";
public static String Symbol => "∠";
public Angle(Double value)
{
var modulo = value % Tau; // tau is 2pi
Value = modulo > PI
? modulo - Tau
: modulo;
}
}