From 006eaa3f1c0b46e70c01a672d919e8740cb8f2bb Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Tue, 31 Oct 2023 16:23:21 +0800 Subject: [PATCH] added kilometer2mile,inch2centimeter,kilometer2nauticalmile..... --- inc/hgl/math/PhysicsConst.h | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/inc/hgl/math/PhysicsConst.h b/inc/hgl/math/PhysicsConst.h index 15fa877..ae1eb5f 100644 --- a/inc/hgl/math/PhysicsConst.h +++ b/inc/hgl/math/PhysicsConst.h @@ -111,5 +111,62 @@ namespace hgl { return k - 273.15; } + + /** + * 公里到英里. + */ + template + inline T Kilometer2Mile(const T &k) + { + return k * 0.621371192; + } + + /** + * 英里到公里. + */ + template + inline T Mile2Kilometer(const T &m) + { + return m * 1.609344; + } + + /** + * 英寸到厘米. + */ + template + inline T Inch2Centimeter(const T &i) + { + return i * 2.54; + } + + /** + * 厘米到英寸. + */ + template + inline T Centimeter2Inch(const T &c) + { + return c * 0.393700787; + } + + /** + * 公里到海里. + */ + template + inline T Kilometer2NauticalMile(const T &k) + { + return k * 0.539956803; + } + + /** + * 海里到公里. + */ + template + inline T NauticalMile2Kilometer(const T &n) + { + return n * 1.852; + } }//namespace hgl #endif//HGL_MATH_PHYSICS_CONST_INCLUDE + + +