Files
MapLibreParticleLab/include/mbgl/style/rotation.hpp
Bart Louwers 71f6da2722 Add clang-format (#1086)
Co-authored-by: mwilsnd <mwilsnd@gmail.com>
2023-05-01 16:57:37 +02:00

27 lines
741 B
C++

#pragma once
#include <mbgl/math/wrap.hpp>
namespace mbgl {
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(mbgl::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 mbgl