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