#include <cmath>

#include "math/MathConstants.h"
#include "math/Vector.h"

template<>
Vector<3>& Vector<3>::setAngles(float lengthAngle, float widthAngle) {
    lengthAngle *= (M_PI / 180.0f);
    widthAngle *= (M_PI / 180.0f);

    float sinWidth = sinf(widthAngle);
    float cosWidth = cosf(widthAngle);

    float sinLength = sinf(lengthAngle);
    float cosLength = cosf(lengthAngle);

    return *this =
               Vector<3>(cosWidth * cosLength, sinWidth, -sinLength * cosWidth);
}

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]);
}