-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApertureAngle.g.cs
More file actions
44 lines (39 loc) · 2.33 KB
/
ApertureAngle.g.cs
File metadata and controls
44 lines (39 loc) · 2.33 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
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.
// <auto-generated />
namespace ktsu.Semantics.Quantities;
using System.Numerics;
/// <summary>
/// Opening angle of a cone or lens.
/// Semantic overload of <see cref="Angle{T}"/>.
/// </summary>
/// <typeparam name="T">The numeric storage type.</typeparam>
public record ApertureAngle<T> : PhysicalQuantity<ApertureAngle<T>, T>, IVector0<ApertureAngle<T>, T>
where T : struct, INumber<T>
{
/// <summary>Gets a quantity with value zero.</summary>
public static ApertureAngle<T> Zero => Create(T.Zero);
/// <summary>
/// Creates a new ApertureAngle from a value in Radian.
/// </summary>
/// <param name="value">The value in Radian.</param>
/// <returns>A new ApertureAngle instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static ApertureAngle<T> FromRadians(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new ApertureAngle from a value in Degree.
/// </summary>
/// <param name="value">The value in Degree.</param>
/// <returns>A new ApertureAngle instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static ApertureAngle<T> FromDegrees(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.DegreeToRadians)), nameof(value)));
/// <summary>Implicit conversion to Angle.</summary>
public static implicit operator Angle<T>(ApertureAngle<T> value) => Angle<T>.Create(value.Value);
/// <summary>Explicit conversion from Angle.</summary>
public static explicit operator ApertureAngle<T>(Angle<T> value) => Create(value.Value);
/// <summary>Creates a ApertureAngle from a Angle value.</summary>
public static ApertureAngle<T> From(Angle<T> value) => Create(value.Value);
/// <summary>Subtracts two ApertureAngle values, returning the absolute difference as a non-negative ApertureAngle.</summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static ApertureAngle<T> operator -(ApertureAngle<T> left, ApertureAngle<T> right) => Create(T.Abs(left.Quantity - right.Quantity));
};