mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
fix: angular
trigonometric functions now can be constrained with QuantityOf<angle>
This commit is contained in:
@@ -33,8 +33,8 @@ using namespace isq;
|
||||
|
||||
// ISQ angular derived quantities redefinition
|
||||
QUANTITY_SPEC(cotes_angle_constant, angular::angle); // 1 rad
|
||||
QUANTITY_SPEC(angular_measure, cotes_angle_constant* arc_length / radius);
|
||||
QUANTITY_SPEC(rotational_displacement, cotes_angle_constant* path_length / radius);
|
||||
QUANTITY_SPEC(angular_measure, angular::angle, cotes_angle_constant* arc_length / radius);
|
||||
QUANTITY_SPEC(rotational_displacement, angular::angle, cotes_angle_constant* path_length / radius);
|
||||
inline constexpr auto angular_displacement = rotational_displacement;
|
||||
QUANTITY_SPEC(phase_angle, angular_measure);
|
||||
QUANTITY_SPEC(solid_angular_measure, pow<2>(cotes_angle_constant) * area / pow<2>(radius));
|
||||
|
@@ -354,8 +354,7 @@ template<QuantityOf<dimension_one> Q>
|
||||
|
||||
namespace angular {
|
||||
|
||||
// TODO cannot use `QuantityOf<angle>` as it is not interconvertible with `isq_angle::angular_measure`
|
||||
template<QuantityOf<dim_angle> Q>
|
||||
template<QuantityOf<angle> Q>
|
||||
requires treat_as_floating_point<typename Q::rep>
|
||||
[[nodiscard]] inline QuantityOf<dimensionless> auto sin(const Q& q) noexcept
|
||||
requires requires { sin(q.number()); } || requires { std::sin(q.number()); }
|
||||
@@ -364,7 +363,7 @@ template<QuantityOf<dim_angle> Q>
|
||||
return sin(q[radian].number()) * one;
|
||||
}
|
||||
|
||||
template<QuantityOf<dim_angle> Q>
|
||||
template<QuantityOf<angle> Q>
|
||||
requires treat_as_floating_point<typename Q::rep>
|
||||
[[nodiscard]] inline QuantityOf<dimensionless> auto cos(const Q& q) noexcept
|
||||
requires requires { cos(q.number()); } || requires { std::cos(q.number()); }
|
||||
@@ -373,7 +372,7 @@ template<QuantityOf<dim_angle> Q>
|
||||
return cos(q[radian].number()) * one;
|
||||
}
|
||||
|
||||
template<QuantityOf<dim_angle> Q>
|
||||
template<QuantityOf<angle> Q>
|
||||
requires treat_as_floating_point<typename Q::rep>
|
||||
[[nodiscard]] inline QuantityOf<dimensionless> auto tan(const Q& q) noexcept
|
||||
requires requires { tan(q.number()); } || requires { std::tan(q.number()); }
|
||||
|
Reference in New Issue
Block a user