RoboidControl-cpp/AngleAxis.cpp
2024-08-06 10:02:01 +02:00

40 lines
1015 B
C++

// 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/.
#include "AngleAxis.h"
template <typename T>
AngleAxis<T>::AngleAxis() {
this->angle = AngleOf<T>();
this->axis = Direction<T>();
}
template <typename T>
AngleAxis<T>::AngleAxis(AngleOf<T> angle, Direction<T> axis) {
this->angle = angle;
this->axis = axis;
}
template <typename T>
AngleAxis<T>::AngleAxis(float angle, Vector3 axis) {
this->angle = AngleOf<T>(angle);
this->axis = Direction<T>(axis);
}
template <typename T>
Quaternion AngleAxis<T>::ToQuaternion() {
Vector3 axisVector = this->axis.ToVector3();
float angleFloat = this->angle.ToFloat();
Quaternion q = Quaternion::AngleAxis(angleFloat, axisVector);
return q;
}
template <typename T>
Direction<T> AngleAxis<T>::GetSwing() {
return this->axis;
}
template class AngleAxis<float>;
template class AngleAxis<signed short>;