c++ - Converting given quantities to different system of base units -
i'm trying use boost-unit 1 of projects. in project several quantities velocity, accelaration, angular velocity represented si-system base units. (m/s, m/s^2, rad/s^2)
the user uses gui interface plot these quantities. let's angular velocity. gui should allow user dynamically change base units, has options:
lengths: m, cm, mm
time: s, ms, min, h
angle: rad, deg
in order use boost-unit project need generic function converting quantity 5*m*s^-2*rad 5*1000/m_pi*180*mm*s^2*deg.
but i'm lost might best approach write function.
i think has like:
template<typename h1, typename h2, typename u, typename v> quantity<v> convert(const quantity<u>& quantity); where h1 , h2 of type homogeneous_system, can build make_system.
Comments
Post a Comment