added convert between Celsius and Fahrenheit Kelvin

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2022-12-30 11:15:19 +08:00
parent 4c696582be
commit e2d4caa59c
2 changed files with 37 additions and 1 deletions

View File

@ -75,5 +75,41 @@ namespace hgl
{
return m0/sqrt(1-(v*v)/(HGL_SPEED_OF_LIGHT*HGL_SPEED_OF_LIGHT));
}
/**
*
*/
template<typename T>
inline T Celsius2Fahrenheit(const T &c)
{
return c*1.8+32;
}
/**
*
*/
template<typename T>
inline T Fahrenheit2Celsius(const T &f)
{
return (f - 32) / 1.8;
}
/**
*
*/
template<typename T>
inline T Celsius2Kelvin(const T &c)
{
return c + 273.15;
}
/**
*
*/
template<typename T>
inline T Kelvin2Celsius(const T &k)
{
return k - 273.15;
}
}//namespace hgl
#endif//HGL_MATH_PHYSICS_CONST_INCLUDE

View File

@ -188,7 +188,7 @@ namespace hgl
return(data.valid()?data->GetFirstChar():0);
}
const T GetLastChar()const ///<取得当前字符串最后一个字符
const T GetLastChar()const ///<取得当前字符串最后一个字符
{
// if(!this)return(0);
return(data.valid()?data->GetLastChar():0);