#include "client/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]); } Vector<3> operator*(const Matrix& m, const Vector<3>& v) { const float* d = m.getValues(); Vector<3> result( v[0] * d[0] + v[1] * d[4] + v[2] * d[8] + d[12], v[0] * d[1] + v[1] * d[5] + v[2] * d[9] + d[13], v[0] * d[2] + v[1] * d[6] + v[2] * d[10] + d[14]); result *= 1.0f / (v[1] * d[3] + v[1] * d[7] + v[2] * d[11] + d[15]); return result; }