-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAngle.g.cs
More file actions
52 lines (47 loc) · 2.97 KB
/
Angle.g.cs
File metadata and controls
52 lines (47 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.
// <auto-generated />
namespace ktsu.Semantics.Quantities;
using System.Numerics;
/// <summary>
/// Magnitude (Vector0) quantity for the AngularDisplacement dimension.
/// </summary>
/// <typeparam name="T">The numeric storage type.</typeparam>
public record Angle<T> : PhysicalQuantity<Angle<T>, T>, IVector0<Angle<T>, T>
where T : struct, INumber<T>
{
/// <summary>Gets a quantity with value zero.</summary>
public static Angle<T> Zero => Create(T.Zero);
/// <summary>
/// Creates a new <see cref="Angle{T}"/> from a value in Radian.
/// </summary>
/// <param name="value">The value in Radian.</param>
/// <returns>A new <see cref="Angle{T}"/> instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Angle<T> FromRadians(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new <see cref="Angle{T}"/> from a value in Degree.
/// </summary>
/// <param name="value">The value in Degree.</param>
/// <returns>A new <see cref="Angle{T}"/> instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Angle<T> FromDegrees(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.DegreeToRadians)), nameof(value)));
/// <summary>
/// Subtracts two Angle values, returning the absolute difference as a non-negative Angle.
/// Magnitude subtraction stays a magnitude (per the unified-vector model).
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Angle<T> operator -(Angle<T> left, Angle<T> right) => Create(T.Abs(left.Quantity - right.Quantity));
/// <summary>
/// Divides Angle by Duration to produce AngularSpeed.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static AngularSpeed<T> operator /(Angle<T> left, Duration<T> right) => Divide<AngularSpeed<T>>(left, right);
/// <summary>
/// Divides Angle by AngularSpeed to produce Duration.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Duration<T> operator /(Angle<T> left, AngularSpeed<T> right) => Divide<Duration<T>>(left, right);
/// <summary>
/// Multiplies Angle by TorqueMagnitude to produce Energy.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Energy<T> operator *(Angle<T> left, TorqueMagnitude<T> right) => Multiply<Energy<T>>(left, right);
};