52 lines
1.3 KiB
C++
52 lines
1.3 KiB
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>
|
|
AngleAxisOf<T>::AngleAxisOf() {
|
|
this->angle = 0.0F;
|
|
this->axis = DirectionOf<T>();
|
|
}
|
|
|
|
template <typename T>
|
|
AngleAxisOf<T>::AngleAxisOf(float angle, DirectionOf<T> axis) {
|
|
this->angle = angle;
|
|
this->axis = axis;
|
|
}
|
|
|
|
template <typename T>
|
|
AngleAxisOf<T>::AngleAxisOf(float angle, Vector3 axis) {
|
|
this->angle = angle;
|
|
this->axis = DirectionOf<T>(axis);
|
|
}
|
|
|
|
template <typename T>
|
|
AngleAxisOf<T>::AngleAxisOf(Quaternion q) {
|
|
float angle;
|
|
Vector3 axis;
|
|
q.ToAngleAxis(&angle, &axis);
|
|
this->angle = angle;
|
|
this->axis = DirectionOf<T>(axis);
|
|
}
|
|
|
|
template <typename T>
|
|
const AngleAxisOf<T> AngleAxisOf<T>::zero =
|
|
AngleAxisOf<T>(0.0, DirectionOf<T>(AngleOf<T>(), AngleOf<T>()));
|
|
|
|
template <typename T>
|
|
Quaternion AngleAxisOf<T>::ToQuaternion() {
|
|
Vector3 axisVector = this->axis.ToVector3();
|
|
Quaternion q = Quaternion::AngleAxis(this->angle, axisVector);
|
|
return q;
|
|
}
|
|
|
|
template <typename T>
|
|
DirectionOf<T> AngleAxisOf<T>::GetSwing() {
|
|
return this->axis;
|
|
}
|
|
|
|
template class AngleAxisOf<float>;
|
|
template class AngleAxisOf<signed short>;
|