Vector.cpp 761 B

123456789101112131415161718192021
  1. #include "math/Vector.hpp"
  2. template<>
  3. Core::Vector3& Core::Vector3::setAngles(float lengthAngle, float widthAngle) {
  4. float sWidth = 0.0f;
  5. float cWidth = 0.0f;
  6. Core::Math::sinCos(Math::degreeToRadian(widthAngle), sWidth, cWidth);
  7. float sLength = 0.0f;
  8. float cLength = 0.0f;
  9. Core::Math::sinCos(Math::degreeToRadian(lengthAngle), sLength, cLength);
  10. return *this = Vector3(cWidth * cLength, sWidth, -sLength * cWidth);
  11. }
  12. template<>
  13. Core::Vector3 Core::Vector3::cross(const Vector3& other) const {
  14. return Vector3(values[1] * other.values[2] - values[2] * other.values[1],
  15. values[2] * other.values[0] - values[0] * other.values[2],
  16. values[0] * other.values[1] - values[1] * other.values[0]);
  17. }