Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@ public record ActivationEnergy<T> : PhysicalQuantity<ActivationEnergy<T>, T>, IV
/// <summary>Gets a quantity with value zero.</summary>
public static ActivationEnergy<T> Zero => Create(T.Zero);

/// <summary>Creates a new ActivationEnergy from a value in JoulePerMole.</summary>
/// <summary>
/// Creates a new ActivationEnergy from a value in JoulePerMole.
/// </summary>
/// <param name="value">The value in JoulePerMole.</param>
/// <returns>A new ActivationEnergy instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static ActivationEnergy<T> FromJoulePerMole(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new ActivationEnergy from a value in KilojoulePerMole.
/// </summary>
/// <param name="value">The value in KilojoulePerMole.</param>
/// <returns>A new ActivationEnergy instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static ActivationEnergy<T> FromKilojoulePerMole(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.KilojoulePerMoleToJoulePerMole)), nameof(value)));
/// <summary>Implicit conversion to MolarEnergy.</summary>
public static implicit operator MolarEnergy<T>(ActivationEnergy<T> value) => MolarEnergy<T>.Create(value.Value);
/// <summary>Explicit conversion from MolarEnergy.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ public record Admittance<T> : PhysicalQuantity<Admittance<T>, T>, IVector0<Admit
/// <summary>Gets a quantity with value zero.</summary>
public static Admittance<T> Zero => Create(T.Zero);

/// <summary>Creates a new Admittance from a value in Siemens.</summary>
/// <summary>
/// Creates a new Admittance from a value in Siemens.
/// </summary>
/// <param name="value">The value in Siemens.</param>
/// <returns>A new Admittance instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Admittance<T> FromSiemens(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>Implicit conversion to Conductance.</summary>
public static implicit operator Conductance<T>(Admittance<T> value) => Conductance<T>.Create(value.Value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,27 @@ public record Airspeed<T> : PhysicalQuantity<Airspeed<T>, T>, IVector0<Airspeed<
/// <summary>Gets a quantity with value zero.</summary>
public static Airspeed<T> Zero => Create(T.Zero);

/// <summary>Creates a new Airspeed from a value in MetersPerSecond.</summary>
/// <summary>
/// Creates a new Airspeed from a value in MetersPerSecond.
/// </summary>
/// <param name="value">The value in MetersPerSecond.</param>
/// <returns>A new Airspeed instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Airspeed<T> FromMetersPerSecond(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new Airspeed from a value in KilometersPerHour.
/// </summary>
/// <param name="value">The value in KilometersPerHour.</param>
/// <returns>A new Airspeed instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Airspeed<T> FromKilometersPerHour(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.KilometersPerHourToMetersPerSecond)), nameof(value)));
/// <summary>
/// Creates a new Airspeed from a value in MilesPerHour.
/// </summary>
/// <param name="value">The value in MilesPerHour.</param>
/// <returns>A new Airspeed instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static Airspeed<T> FromMilesPerHour(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.MilesPerHourToMetersPerSecond)), nameof(value)));
/// <summary>Implicit conversion to Speed.</summary>
public static implicit operator Speed<T>(Airspeed<T> value) => Speed<T>.Create(value.Value);
/// <summary>Explicit conversion from Speed.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,83 @@ public record Altitude<T> : PhysicalQuantity<Altitude<T>, T>, IVector0<Altitude<
/// <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>
/// <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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ public record Angle<T> : PhysicalQuantity<Angle<T>, T>, IVector0<Angle<T>, T>
/// <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> FromRadian(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> FromDegree(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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ public record AngularSpeed<T> : PhysicalQuantity<AngularSpeed<T>, T>, IVector0<A
/// <returns>A new <see cref="AngularSpeed{T}"/> instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AngularSpeed<T> FromRadiansPerSecond(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new <see cref="AngularSpeed{T}"/> from a value in RevolutionsPerMinute.
/// </summary>
/// <param name="value">The value in RevolutionsPerMinute.</param>
/// <returns>A new <see cref="AngularSpeed{T}"/> instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AngularSpeed<T> FromRevolutionsPerMinute(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.RevolutionsPerMinuteToRadiansPerSecond)), nameof(value)));
/// <summary>
/// Subtracts two AngularSpeed values, returning the absolute difference as a non-negative AngularSpeed.
/// Magnitude subtraction stays a magnitude (per the unified-vector model).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public record AngularVelocity1D<T> : PhysicalQuantity<AngularVelocity1D<T>, T>,
/// <param name="value">The value in RadiansPerSecond.</param>
/// <returns>A new <see cref="AngularVelocity1D{T}"/> instance.</returns>
public static AngularVelocity1D<T> FromRadiansPerSecond(T value) => Create(value);
/// <summary>
/// Creates a new <see cref="AngularVelocity1D{T}"/> from a value in RevolutionsPerMinute.
/// </summary>
/// <param name="value">The value in RevolutionsPerMinute.</param>
/// <returns>A new <see cref="AngularVelocity1D{T}"/> instance.</returns>
public static AngularVelocity1D<T> FromRevolutionsPerMinute(T value) => Create((value * T.CreateChecked(Units.ConversionConstants.RevolutionsPerMinuteToRadiansPerSecond)));
/// <summary>
/// Gets the magnitude of this quantity as a <see cref="AngularSpeed{T}"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@ public record ApertureAngle<T> : PhysicalQuantity<ApertureAngle<T>, T>, IVector0
/// <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>
/// <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> FromRadian(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> FromDegree(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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ public record Area<T> : PhysicalQuantity<Area<T>, T>, IVector0<Area<T>, T>
/// <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> FromSquareMeter(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> FromSquareFoot(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> FromSquareInch(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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,34 @@ public record AtmosphericPressure<T> : PhysicalQuantity<AtmosphericPressure<T>,
/// <summary>Gets a quantity with value zero.</summary>
public static AtmosphericPressure<T> Zero => Create(T.Zero);

/// <summary>Creates a new AtmosphericPressure from a value in Pascal.</summary>
/// <summary>
/// Creates a new AtmosphericPressure from a value in Pascal.
/// </summary>
/// <param name="value">The value in Pascal.</param>
/// <returns>A new AtmosphericPressure instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AtmosphericPressure<T> FromPascal(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new AtmosphericPressure from a value in Bar.
/// </summary>
/// <param name="value">The value in Bar.</param>
/// <returns>A new AtmosphericPressure instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AtmosphericPressure<T> FromBar(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.BarToPascals)), nameof(value)));
/// <summary>
/// Creates a new AtmosphericPressure from a value in Atmosphere.
/// </summary>
/// <param name="value">The value in Atmosphere.</param>
/// <returns>A new AtmosphericPressure instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AtmosphericPressure<T> FromAtmosphere(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.AtmosphereToPascals)), nameof(value)));
/// <summary>
/// Creates a new AtmosphericPressure from a value in Psi.
/// </summary>
/// <param name="value">The value in Psi.</param>
/// <returns>A new AtmosphericPressure instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AtmosphericPressure<T> FromPsi(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.PsiToPascals)), nameof(value)));
/// <summary>Implicit conversion to Pressure.</summary>
public static implicit operator Pressure<T>(AtmosphericPressure<T> value) => Pressure<T>.Create(value.Value);
/// <summary>Explicit conversion from Pressure.</summary>
Expand Down
Loading
Loading