This commit is contained in:
2025-07-08 16:21:03 +03:00
parent c7693b7fea
commit 646b0bde50
9 changed files with 413 additions and 56 deletions

View File

@@ -80,21 +80,29 @@ public:
// }
// by default angle is in radians
template <typename T>
MccAngle(const T& val, const MccRadianTag = MccRadianTag{})
requires std::is_arithmetic_v<T>
: _angleInRads(val)
{
}
// template <typename T>
// MccAngle(const T& val, const MccRadianTag = MccRadianTag{})
// requires std::is_arithmetic_v<T>
// : _angleInRads(val)
// {
// }
// // construct angle in degrees, e.g.:
// // auto ang = MccAngle{180.0, mcc_degrees};
// template <typename T>
// MccAngle(const T& val, const MccDegreeTag)
// requires std::is_arithmetic_v<T>
// : _angleInRads(val * utils::deg2radCoeff)
// {
// }
// by default angle is in radians
MccAngle(const double& val, const MccRadianTag = MccRadianTag{}) : _angleInRads(val) {}
// construct angle in degrees, e.g.:
// auto ang = MccAngle{180.0, mcc_degrees};
template <typename T>
MccAngle(const T& val, const MccDegreeTag)
requires std::is_arithmetic_v<T>
: _angleInRads(val * utils::deg2radCoeff)
{
}
MccAngle(const double& val, const MccDegreeTag) : _angleInRads(val * utils::deg2radCoeff) {}
@@ -126,6 +134,31 @@ public:
virtual ~MccAngle() = default;
template <std::derived_from<MccAngle> T>
auto& operator=(this T&& self, const T& other)
{
std::forward<decltype(self)>(self)._angleInRads = other._angleInRads;
return self;
}
template <std::derived_from<MccAngle> T>
auto& operator=(this T&& self, T&& other)
{
std::forward<decltype(self)>(self)._angleInRads = std::move(other._angleInRads);
return self;
}
template <typename T>
auto& operator=(this auto&& self, const T& val)
requires std::is_arithmetic_v<T>
{
std::forward<decltype(self)>(self)._angleInRads = val;
return self;
}
// normalize coordinate
template <norm_kind_t KIND>
MccAngle& normalize()