Cleanup template classes
This commit is contained in:
parent
ea6894e05b
commit
cf86ba82ac
@ -4,33 +4,36 @@
|
||||
|
||||
#include "AngleAxis.h"
|
||||
|
||||
// template <typename T>
|
||||
// AngleAxis<T>::AngleAxis() {
|
||||
// this->angle = Angle();
|
||||
// this->axis = Direction<T>();
|
||||
// }
|
||||
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(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>
|
||||
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>
|
||||
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 <typename T>
|
||||
Direction<T> AngleAxis<T>::GetSwing() {
|
||||
return this->axis;
|
||||
}
|
||||
|
||||
template class AngleAxis<float>;
|
||||
template class AngleAxis<signed short>;
|
||||
|
31
AngleAxis.h
31
AngleAxis.h
@ -27,39 +27,8 @@ class AngleAxis {
|
||||
Direction<T> GetSwing();
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
} // namespace LinearAlgebra
|
||||
} // namespace Passer
|
||||
using namespace Passer::LinearAlgebra;
|
||||
|
||||
template <typename T>
|
||||
AngleAxis<T>::AngleAxis() {
|
||||
this->angle = Angle();
|
||||
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>
|
||||
Direction<T> AngleAxis<T>::GetSwing() {
|
||||
return this->axis;
|
||||
}
|
||||
|
||||
#endif
|
@ -9,24 +9,24 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// template <typename T>
|
||||
// Direction<T>::Direction() {
|
||||
// this->horizontalAngle = AngleOf<T>(0.0f);
|
||||
// this->verticalAngle = AngleOf<T>(0.0f);
|
||||
// }
|
||||
template <typename T>
|
||||
Direction<T>::Direction() {
|
||||
this->horizontalAngle = AngleOf<T>(0.0f);
|
||||
this->verticalAngle = AngleOf<T>(0.0f);
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// Direction<T>::Direction(AngleOf<T> horizontal, AngleOf<T> vertical) {
|
||||
// this->horizontalAngle = horizontal;
|
||||
// this->verticalAngle = vertical;
|
||||
// };
|
||||
template <typename T>
|
||||
Direction<T>::Direction(AngleOf<T> horizontal, AngleOf<T> vertical) {
|
||||
this->horizontalAngle = horizontal;
|
||||
this->verticalAngle = vertical;
|
||||
};
|
||||
|
||||
// template <typename T>
|
||||
// Direction<T>::Direction(Vector3 v) {
|
||||
// this->horizontalAngle =
|
||||
// atan2f(v.Right(), v.Forward()) * Passer::LinearAlgebra::Rad2Deg;
|
||||
// this->verticalAngle = 90 - acosf(v.Up()) * Passer::LinearAlgebra::Rad2Deg;
|
||||
// }
|
||||
template <typename T>
|
||||
Direction<T>::Direction(Vector3 v) {
|
||||
this->horizontalAngle =
|
||||
atan2f(v.Right(), v.Forward()) * Passer::LinearAlgebra::Rad2Deg;
|
||||
this->verticalAngle = 90 - acosf(v.Up()) * Passer::LinearAlgebra::Rad2Deg;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const Direction<T> Direction<T>::forward = Direction<T>(0.0f, 0.0f);
|
||||
@ -41,10 +41,14 @@ const Direction<T> Direction<T>::left = Direction<T>(-90.0f, 0.0f);
|
||||
template <typename T>
|
||||
const Direction<T> Direction<T>::right = Direction<T>(90.0f, 0.0f);
|
||||
|
||||
// template <typename T>
|
||||
// Vector3 Direction<T>::ToVector3() {
|
||||
// Vector3 v = Quaternion::Euler(-(this->verticalAngle.ToFloat()),
|
||||
// this->horizontalAngle.ToFloat(), 0) *
|
||||
// Vector3::forward;
|
||||
// return v;
|
||||
// }
|
||||
template <typename T>
|
||||
Vector3 Direction<T>::ToVector3() {
|
||||
Vector3 v = Quaternion::Euler(-(this->verticalAngle.ToFloat()),
|
||||
this->horizontalAngle.ToFloat(), 0) *
|
||||
Vector3::forward;
|
||||
return v;
|
||||
}
|
||||
|
||||
template class Direction<float>;
|
||||
template class Direction<signed short>;
|
||||
template class Direction<signed char>;
|
31
Direction.h
31
Direction.h
@ -36,35 +36,4 @@ class Direction {
|
||||
} // namespace Passer
|
||||
using namespace Passer::LinearAlgebra;
|
||||
|
||||
#include <math.h>
|
||||
#include "Quaternion.h"
|
||||
#include "Vector3.h"
|
||||
|
||||
template <typename T>
|
||||
Direction<T>::Direction() {
|
||||
this->horizontalAngle = AngleOf<T>(0.0f);
|
||||
this->verticalAngle = AngleOf<T>(0.0f);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Direction<T>::Direction(AngleOf<T> horizontal, AngleOf<T> vertical) {
|
||||
this->horizontalAngle = horizontal;
|
||||
this->verticalAngle = vertical;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
Direction<T>::Direction(Vector3 v) {
|
||||
this->horizontalAngle =
|
||||
atan2f(v.Right(), v.Forward()) * Passer::LinearAlgebra::Rad2Deg;
|
||||
this->verticalAngle = 90 - acosf(v.Up()) * Passer::LinearAlgebra::Rad2Deg;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Vector3 Direction<T>::ToVector3() {
|
||||
Vector3 v = Quaternion::Euler(-(this->verticalAngle.ToFloat()),
|
||||
this->horizontalAngle.ToFloat(), 0) *
|
||||
Vector3::forward;
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user