#include <cmath>

#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;
    float cosWidth;
    sincosf(widthAngle, &sinWidth, &cosWidth);

    float sinLength;
    float cosLength;
    sincosf(lengthAngle, &sinLength, &cosLength);

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