...
This commit is contained in:
@@ -63,22 +63,20 @@ protected:
|
||||
|
||||
public:
|
||||
enum norm_kind_t {
|
||||
NORM_KIND_0_360, // [0,360]
|
||||
NORM_KIND_0_180, // [0,180]
|
||||
NORM_KIND_90_90, // [-90,90]
|
||||
NORM_KIND_0_360, // [0,360]
|
||||
NORM_KIND_0_180, // [0,180]
|
||||
NORM_KIND_180_180, // [-180,180]
|
||||
NORM_KIND_90_90, // [-90,90]
|
||||
};
|
||||
|
||||
MccAngle() = default;
|
||||
|
||||
// by default angle is in radians
|
||||
MccAngle(std::convertible_to<double> auto const& val, const MccRadianTag tag = MccRadianTag{})
|
||||
: _angleInRads(val)
|
||||
{
|
||||
}
|
||||
MccAngle(std::convertible_to<double> auto const& val, const MccRadianTag = MccRadianTag{}) : _angleInRads(val) {}
|
||||
|
||||
// construct angle in degrees, e.g.:
|
||||
// auto ang = MccAngle{180.0, mcc_degrees};
|
||||
MccAngle(std::convertible_to<double> auto const& val, const MccDegreeTag tag)
|
||||
MccAngle(std::convertible_to<double> auto const& val, const MccDegreeTag)
|
||||
{
|
||||
_angleInRads = val * utils::deg2radCoeff;
|
||||
}
|
||||
@@ -127,6 +125,12 @@ public:
|
||||
} else if (_angleInRads < 0.0) {
|
||||
_angleInRads = -_angleInRads;
|
||||
}
|
||||
} else if constexpr (KIND == NORM_KIND_180_180) {
|
||||
if (_angleInRads > std::numbers::pi) {
|
||||
_angleInRads = 2.0 * std::numbers::pi - _angleInRads;
|
||||
} else if (_angleInRads < -std::numbers::pi) {
|
||||
_angleInRads += 2.0 * std::numbers::pi;
|
||||
}
|
||||
} else if constexpr (KIND == NORM_KIND_90_90) {
|
||||
if (_angleInRads >= 1.5 * std::numbers::pi) {
|
||||
_angleInRads = _angleInRads - 2.0 * std::numbers::pi;
|
||||
@@ -175,8 +179,7 @@ public:
|
||||
return sexagesimal<std::string>(hms, prec);
|
||||
}
|
||||
|
||||
friend MccAngle operator+(std::convertible_to<MccAngle> auto&& left,
|
||||
std::convertible_to<MccAngle> auto&& right)
|
||||
friend MccAngle operator+(std::convertible_to<MccAngle> auto&& left, std::convertible_to<MccAngle> auto&& right)
|
||||
{
|
||||
// return std::forward<decltype(left)>(left)._angleInRads +
|
||||
// std::forward<decltype(right)>(right)._angleInRads;
|
||||
@@ -189,8 +192,7 @@ public:
|
||||
// }
|
||||
|
||||
|
||||
friend MccAngle operator-(std::convertible_to<MccAngle> auto&& left,
|
||||
std::convertible_to<MccAngle> auto&& right)
|
||||
friend MccAngle operator-(std::convertible_to<MccAngle> auto&& left, std::convertible_to<MccAngle> auto&& right)
|
||||
{
|
||||
// return std::forward<decltype(left)>(left)._angleInRads -
|
||||
// std::forward<decltype(right)>(right)._angleInRads;
|
||||
|
||||
Reference in New Issue
Block a user