units
units copied to clipboard
Support for equivalent units
The following code calculates the angular acceleration when applying torque to a body with a given rotational inertia. However, the resulting unit [N/(kg*m)]
should be convertible to [rad/s^2]
. What support is there for this in the library?
using kilogram_meters_squared_t = decltype(1.0_kg * 1.0_sq_m);
using radians_per_second_squared_t = decltype(1.0_rad / 1.0_s / 1.0_s);
const kilogram_meters_squared_t inertia = kilogram_meters_squared_t{1.0};
const newton_meter_t torque = 1.0_Nm;
// Conversion should happen automatically
const radians_per_second_squared_t angular_acc{(torque / inertia).to<float>()};