// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0.If a copy of the MPL was not distributed with this // file, You can obtain one at https ://mozilla.org/MPL/2.0/. #ifndef DIRECTION_H #define DIRECTION_H #include "Angle.h" namespace Passer { namespace LinearAlgebra { struct Vector3; template class DirectionOf { public: /// @brief horizontal angle, range= (-180..180] AngleOf horizontal; /// @brief vertical angle, range in degrees = (-90..90] AngleOf vertical; DirectionOf(); DirectionOf(AngleOf horizontal, AngleOf vertical); // DirectionOf(Vector3 v); Vector3 ToVector3() const; static DirectionOf FromVector3(Vector3 v); static DirectionOf Degrees(float horizontal, float vertical); static DirectionOf Radians(float horizontal, float vertical); const static DirectionOf forward; const static DirectionOf back; const static DirectionOf up; const static DirectionOf down; const static DirectionOf left; const static DirectionOf right; bool operator==(const DirectionOf d) const; DirectionOf operator-() const; Vector3 ToVector3(); protected: void Normalize(); }; using DirectionSingle = DirectionOf; using Direction16 = DirectionOf; using Direction = DirectionOf; } // namespace LinearAlgebra } // namespace Passer using namespace Passer::LinearAlgebra; #endif