Files
MapLibreParticleLab/include/mln/style/rotation.hpp
Bart Louwers 2a8ebc4906 core: rename mbgl directories to mln (#4511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-22 20:50:14 +02:00

27 lines
737 B
C++

#pragma once
#include <mln/math/wrap.hpp>
namespace mln {
namespace style {
// Could be made a template class if needed
// template <size_t Period>
// size_t period() const noexcept { return Period; }
class Rotation {
public:
Rotation() = default;
Rotation(double angle_)
: angle(mln::util::wrap<double>(angle_, 0, period())) {}
constexpr double period() const noexcept { return 360.0; }
double getAngle() const noexcept { return angle; }
friend bool operator==(const Rotation& lhs, const Rotation& rhs) { return lhs.angle == rhs.angle; }
friend bool operator!=(const Rotation& lhs, const Rotation& rhs) { return !(lhs == rhs); }
private:
double angle;
};
} // namespace style
} // namespace mln