21 lines
499 B
C#
21 lines
499 B
C#
using InnovEnergy.Lib.SrcGen;
|
|
using InnovEnergy.Lib.SrcGen.Attributes;
|
|
using static System.Math;
|
|
|
|
namespace InnovEnergy.Lib.Units;
|
|
|
|
[Generate<Operators>("HAS_CONSTRUCTOR")][Generate<Sum>]
|
|
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;
|
|
}
|
|
} |