-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathArea.g.cs
More file actions
71 lines (66 loc) · 4.54 KB
/
Area.g.cs
File metadata and controls
71 lines (66 loc) · 4.54 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
// 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 Area dimension.
/// </summary>
/// <typeparam name="T">The numeric storage type.</typeparam>
public record Area<T> : PhysicalQuantity<Area<T>, T>, IVector0<Area<T>, T>
where T : struct, INumber<T>
{
/// <summary>Gets a quantity with value zero.</summary>
public static Area<T> Zero => Create(T.Zero);
/// <summary>
/// Creates a new <see cref="Area{T}"/> from a value in SquareMeter.
/// </summary>
/// <param name="value">The value in SquareMeter.</param>
/// <returns>A new <see cref="Area{T}"/> instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Area<T> FromSquareMeters(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new <see cref="Area{T}"/> from a value in SquareFoot.
/// </summary>
/// <param name="value">The value in SquareFoot.</param>
/// <returns>A new <see cref="Area{T}"/> instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Area<T> FromSquareFeet(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.SquareFootToSquareMeters)), nameof(value)));
/// <summary>
/// Creates a new <see cref="Area{T}"/> from a value in SquareInch.
/// </summary>
/// <param name="value">The value in SquareInch.</param>
/// <returns>A new <see cref="Area{T}"/> instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Area<T> FromSquareInches(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.SquareInchToSquareMeters)), nameof(value)));
/// <summary>
/// Subtracts two Area values, returning the absolute difference as a non-negative Area.
/// 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 Area<T> operator -(Area<T> left, Area<T> right) => Create(T.Abs(left.Quantity - right.Quantity));
/// <summary>
/// Divides Area by Length to produce Length.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Length<T> operator /(Area<T> left, Length<T> right) => Divide<Length<T>>(left, right);
/// <summary>
/// Multiplies Area by Length to produce Volume.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Volume<T> operator *(Area<T> left, Length<T> right) => Multiply<Volume<T>>(left, right);
/// <summary>
/// Multiplies Area by Pressure to produce ForceMagnitude.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static ForceMagnitude<T> operator *(Area<T> left, Pressure<T> right) => Multiply<ForceMagnitude<T>>(left, right);
/// <summary>
/// Multiplies Area by Illuminance to produce LuminousFlux.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static LuminousFlux<T> operator *(Area<T> left, Illuminance<T> right) => Multiply<LuminousFlux<T>>(left, right);
/// <summary>
/// Multiplies Area by MagneticFluxDensityMagnitude to produce MagneticFlux.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static MagneticFlux<T> operator *(Area<T> left, MagneticFluxDensityMagnitude<T> right) => Multiply<MagneticFlux<T>>(left, right);
/// <summary>
/// Multiplies Area by Irradiance to produce Power.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static Power<T> operator *(Area<T> left, Irradiance<T> right) => Multiply<Power<T>>(left, right);
};