-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAltitude.g.cs
More file actions
32 lines (27 loc) · 1.55 KB
/
Altitude.g.cs
File metadata and controls
32 lines (27 loc) · 1.55 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
// 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>
public static Altitude<T> FromMeter(T value) => Create(Vector0Guards.EnsureNonNegative(value, 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));
};