#pragma once #include #include "Vector.hpp" struct Rotation { Rotation() = default; Rotation(Vector<3> vector) : vector{ wrap(vector) } {} explicit Rotation(Real angles[3]) : Rotation(angles[0], angles[1], angles[2]) {} Rotation(Real pitch, Real yaw, Real roll) { vector = wrap({pitch, yaw, roll }); } Rotation operator+(Rotation other) const { return wrap(vector + other.vector); } std::string string() const { return vector.string(); } static Vector<3> wrap(Vector<3> v) { return v.map([](auto a) { return fmod(a, 360.0f); }); } Real& pitch() { return vector[0]; } Real& yaw() { return vector[1]; } Real& roll() { return vector[2]; } Vector<3> vector; };