-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAltitude.g.cs
More file actions
107 lines (102 loc) · 6.35 KB
/
Copy pathAltitude.g.cs
File metadata and controls
107 lines (102 loc) · 6.35 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.
// <auto-generated />
namespace ktsu.Semantics.Quantities;
using System.Numerics;
/// <summary>
/// Height above a reference level.
/// Semantic overload of <see cref="Length{T}"/>.
/// </summary>
/// <typeparam name="T">The numeric storage type.</typeparam>
public record Altitude<T> : PhysicalQuantity<Altitude<T>, T>, IVector0<Altitude<T>, T>
where T : struct, INumber<T>
{
/// <summary>Gets a quantity with value zero.</summary>
public static Altitude<T> Zero => Create(T.Zero);
/// <summary>
/// Creates a new Altitude from a value in Meter.
/// </summary>
/// <param name="value">The value in Meter.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromMeter(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Kilometer.
/// </summary>
/// <param name="value">The value in Kilometer.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromKilometer(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(MetricMagnitudes.Kilo)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Centimeter.
/// </summary>
/// <param name="value">The value in Centimeter.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromCentimeter(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(MetricMagnitudes.Centi)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Millimeter.
/// </summary>
/// <param name="value">The value in Millimeter.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromMillimeter(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(MetricMagnitudes.Milli)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Micrometer.
/// </summary>
/// <param name="value">The value in Micrometer.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromMicrometer(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(MetricMagnitudes.Micro)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Nanometer.
/// </summary>
/// <param name="value">The value in Nanometer.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromNanometer(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(MetricMagnitudes.Nano)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Angstrom.
/// </summary>
/// <param name="value">The value in Angstrom.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromAngstrom(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.AngstromToMeters)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Foot.
/// </summary>
/// <param name="value">The value in Foot.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromFoot(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.FeetToMeters)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Inch.
/// </summary>
/// <param name="value">The value in Inch.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromInch(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.InchesToMeters)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Yard.
/// </summary>
/// <param name="value">The value in Yard.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromYard(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.YardToMeters)), nameof(value)));
/// <summary>
/// Creates a new Altitude from a value in Mile.
/// </summary>
/// <param name="value">The value in Mile.</param>
/// <returns>A new Altitude instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Altitude<T> FromMile(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.MileToMeters)), nameof(value)));
/// <summary>Implicit conversion to Length.</summary>
public static implicit operator Length<T>(Altitude<T> value) => Length<T>.Create(value.Value);
/// <summary>Explicit conversion from Length.</summary>
public static explicit operator Altitude<T>(Length<T> value) => Create(value.Value);
/// <summary>Creates a Altitude from a Length value.</summary>
public static Altitude<T> From(Length<T> value) => Create(value.Value);
/// <summary>Subtracts two Altitude values, returning the absolute difference as a non-negative Altitude.</summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Altitude<T> operator -(Altitude<T> left, Altitude<T> right) => Create(T.Abs(left.Quantity - right.Quantity));
};