2021-07-17 02:37:09 +02:00
|
|
|
|
using Content.Shared.Maths;
|
2020-08-08 18:24:41 +02:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Shared.Temperature
|
2020-08-08 18:24:41 +02:00
|
|
|
|
{
|
|
|
|
|
|
public static class TemperatureHelpers
|
|
|
|
|
|
{
|
|
|
|
|
|
public static float CelsiusToKelvin(float celsius)
|
|
|
|
|
|
{
|
|
|
|
|
|
return celsius + PhysicalConstants.ZERO_CELCIUS;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-09-01 23:33:42 +02:00
|
|
|
|
public static float CelsiusToFahrenheit(float celsius)
|
|
|
|
|
|
{
|
|
|
|
|
|
return celsius * 9 / 5 + 32;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-08 18:24:41 +02:00
|
|
|
|
public static float KelvinToCelsius(float kelvin)
|
|
|
|
|
|
{
|
|
|
|
|
|
return kelvin - PhysicalConstants.ZERO_CELCIUS;
|
|
|
|
|
|
}
|
2020-09-01 23:33:42 +02:00
|
|
|
|
|
|
|
|
|
|
public static float KelvinToFahrenheit(float kelvin)
|
|
|
|
|
|
{
|
|
|
|
|
|
var celsius = KelvinToCelsius(kelvin);
|
|
|
|
|
|
return CelsiusToFahrenheit(celsius);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static float FahrenheitToCelsius(float fahrenheit)
|
|
|
|
|
|
{
|
|
|
|
|
|
return (fahrenheit - 32) * 5 / 9;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static float FahrenheitToKelvin(float fahrenheit)
|
|
|
|
|
|
{
|
|
|
|
|
|
var celsius = FahrenheitToCelsius(fahrenheit);
|
|
|
|
|
|
return CelsiusToKelvin(celsius);
|
|
|
|
|
|
}
|
2020-08-08 18:24:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|