#pragma once #include #include namespace orange { namespace detail { template class Radian; template class Degree : public Unit { public: constexpr Degree() {} constexpr explicit Degree(T value) : Unit(value) { } constexpr Degree(Unit value) : Unit(value) { } template constexpr explicit Degree(Unit value) : Unit(value) { } constexpr Degree(Unit value); }; template class Radian : public Unit { public: Radian() {} constexpr explicit Radian(T value) : Unit(value) { } constexpr Radian(Unit value) : Unit(value) { } template constexpr explicit Radian(Unit value) : Unit(value) { } constexpr Radian(Unit value); }; template constexpr Degree::Degree(Unit value) : Unit(T(360) * T(value) / Math::Tau) { } template constexpr Radian::Radian(Unit value) : Unit(T(value) * Math::Tau / T(360)) { } } using Radian = detail::Radian; using Degree = detail::Degree; constexpr Radian operator"" _rad(long double value) { return Radian{static_cast(value)}; } constexpr Radian operator"" _rad(unsigned long long value) { return Radian{static_cast(value)}; } constexpr Degree operator"" _deg(long double value) { return Degree{static_cast(value)}; } constexpr Degree operator"" _deg(unsigned long long value) { return Degree{static_cast(value)}; } struct EulerAngles { Radian pitch; Radian yaw; Radian roll; }; }