fix: 💥 dim_torque now properly divides by an angle (instead of multiply) + default unit name change

Resolves #220
This commit is contained in:
Mateusz Pusz
2021-02-15 15:01:56 +01:00
parent efeacca9ee
commit 4d965d7f47
5 changed files with 15 additions and 9 deletions
@@ -28,8 +28,8 @@
namespace units::physical {
template<typename Child, Unit U, DimensionOfT<dim_energy> E, DimensionOfT<dim_angle> A>
struct dim_torque : derived_dimension<Child, U, exponent<E, 1>, exponent<A, 1>> {};
template<typename Child, Unit U, DimensionOfT<dim_force> F, DimensionOfT<dim_length> L, DimensionOfT<dim_angle> A>
struct dim_torque : derived_dimension<Child, U, exponent<F, 1>, exponent<L, 1>, exponent<A, -1>> {};
template<typename T>
concept Torque = QuantityOfT<T, dim_torque>;
@@ -30,9 +30,9 @@
namespace units::physical::si {
struct newton_metre : named_unit<newton_metre, "Nm", prefix> {};
struct newton_metre_per_radian : unit<newton_metre_per_radian> {};
struct dim_torque : physical::dim_torque<dim_torque, newton_metre, dim_energy, dim_angle<>> {};
struct dim_torque : physical::dim_torque<dim_torque, newton_metre_per_radian, dim_force, dim_length, dim_angle<>> {};
template<UnitOf<dim_torque> U, QuantityValue Rep = double>
using torque = quantity<dim_torque, U, Rep>;
@@ -40,14 +40,14 @@ using torque = quantity<dim_torque, U, Rep>;
inline namespace literals {
// Nm
constexpr auto operator"" _q_Nm(unsigned long long l) { return torque<newton_metre, std::int64_t>(l); }
constexpr auto operator"" _q_Nm(long double l) { return torque<newton_metre, long double>(l); }
constexpr auto operator"" _q_Nm_per_rad(unsigned long long l) { return torque<newton_metre_per_radian, std::int64_t>(l); }
constexpr auto operator"" _q_Nm_per_rad(long double l) { return torque<newton_metre_per_radian, long double>(l); }
} // namespace literals
namespace unit_constants {
inline constexpr auto Nm = torque<newton_metre, one_rep>{};
inline constexpr auto Nm_per_rad = torque<newton_metre_per_radian, one_rep>{};
} // namespace unit_constants