// 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 ANGLEAXIS_H #define ANGLEAXIS_H #include "Angle.h" #include "Direction.h" #include "Quaternion.h" namespace Passer { namespace LinearAlgebra { template class AngleAxis { public: AngleOf angle; Direction axis; AngleAxis(); AngleAxis(AngleOf angle, Direction axis); AngleAxis(float angle, Vector3 axis); Quaternion ToQuaternion(); Direction GetSwing(); }; template Quaternion AngleAxis::ToQuaternion() { Vector3 axisVector = this->axis.ToVector3(); float angleFloat = this->angle.ToFloat(); Quaternion q = Quaternion::AngleAxis(angleFloat, axisVector); return q; } } // namespace LinearAlgebra } // namespace Passer using namespace Passer::LinearAlgebra; template AngleAxis::AngleAxis() { this->angle = Angle(); this->axis = Direction(); } template AngleAxis::AngleAxis(AngleOf angle, Direction axis) { this->angle = angle; this->axis = axis; } template AngleAxis::AngleAxis(float angle, Vector3 axis) { this->angle = AngleOf(angle); this->axis = Direction(axis); } template Direction AngleAxis::GetSwing() { return this->axis; } #endif