Vector.cpp 709 B

123456789101112131415161718192021
  1. #include "math/Vector.h"
  2. template<>
  3. Vector3& Vector3::setAngles(float lengthAngle, float widthAngle) {
  4. float sWidth = 0.0f;
  5. float cWidth = 0.0f;
  6. sincosf(widthAngle * (M_PI / 180.0f), &sWidth, &cWidth);
  7. float sLength = 0.0f;
  8. float cLength = 0.0f;
  9. sincosf(lengthAngle * (M_PI / 180.0f), &sLength, &cLength);
  10. return *this = Vector3(cWidth * cLength, sWidth, -sLength * cWidth);
  11. }
  12. template<>
  13. Vector3 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. }