123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #include "common/math/Vector.h"
- template<>
- Vector<3>::Vector(float x, float y, float z) {
- values[0] = x;
- values[1] = y;
- values[2] = z;
- }
- template<>
- Vector<2>::Vector(float x, float y) {
- values[0] = x;
- values[1] = y;
- }
- template<>
- Vector<3>& Vector<3>::setAngles(float lengthAngle, float widthAngle) {
- lengthAngle *= (M_PI / 180.0f);
- widthAngle *= (M_PI / 180.0f);
- values[0] = cosf(widthAngle) * sinf(lengthAngle);
- values[1] = sinf(widthAngle);
- values[2] = cosf(widthAngle) * cosf(lengthAngle);
- return *this;
- }
- template<>
- Vector<3>::Vector(float lengthAngle, float widthAngle) {
- setAngles(lengthAngle, widthAngle);
- }
- template<>
- Vector<3>& Vector<3>::set(float x, float y, float z) {
- values[0] = x;
- values[1] = y;
- values[2] = z;
- return *this;
- }
- template<>
- Vector<3> Vector<3>::cross(const Vector<3>& other) const {
- return Vector<3>(
- values[1] * other.values[2] - values[2] * other.values[1],
- values[2] * other.values[0] - values[0] * other.values[2],
- values[0] * other.values[1] - values[1] * other.values[0]);
- }
|