MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rotation.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <mbgl/math/wrap.hpp>
3 namespace mbgl {
4 namespace style {
5 
6 // Could be made a template class if needed
7 // template <size_t Period>
8 // size_t period() const noexcept { return Period; }
9 class Rotation {
10 public:
11  Rotation() = default;
12  Rotation(double angle_) : angle(mbgl::util::wrap<double>(angle_, 0, period())) {}
13  constexpr double period() const noexcept { return 360.0; }
14  double getAngle() const noexcept { return angle; }
15 
16  friend bool operator==(const Rotation& lhs, const Rotation& rhs) { return lhs.angle == rhs.angle; }
17 
18  friend bool operator!=(const Rotation& lhs, const Rotation& rhs) { return !(lhs == rhs); }
19 
20 private:
21  double angle;
22 };
23 
24 } // namespace style
25 } // namespace mbgl
friend bool operator!=(const Rotation &lhs, const Rotation &rhs)
Definition: rotation.hpp:18
double getAngle() const noexcept
Definition: rotation.hpp:14
friend bool operator==(const Rotation &lhs, const Rotation &rhs)
Definition: rotation.hpp:16
Rotation(double angle_)
Definition: rotation.hpp:12
constexpr double period() const noexcept
Definition: rotation.hpp:13
T wrap(T value, T min, T max)
Definition: wrap.hpp:11
Definition: actor.hpp:15