Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Vec3.h 926B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*!
  2. * \file include/math/Vec3.h
  3. * \brief 3D Math vector
  4. *
  5. * \author xythobuz
  6. * \author Mongoose
  7. */
  8. #ifndef _MATH_VEC3_H_
  9. #define _MATH_VEC3_H_
  10. #include "math/math.h"
  11. class Vec3 {
  12. public:
  13. Vec3(float _x = 0.0f, float _y = 0.0f, float _z = 0.0f);
  14. Vec3(float v[3]);
  15. float magnitude();
  16. void normalize();
  17. Vec3 unit();
  18. Vec3 operator +(const Vec3& v);
  19. Vec3 operator -(const Vec3& v);
  20. Vec3 operator -();
  21. Vec3 operator *(float s);
  22. Vec3 operator /(float s);
  23. float operator *(const Vec3& v);
  24. Vec3& operator +=(const Vec3& v);
  25. Vec3& operator -=(const Vec3& v);
  26. Vec3& operator *=(float s);
  27. bool operator ==(const Vec3& v);
  28. bool operator !=(const Vec3& v);
  29. float x, y, z;
  30. // ----------------------------------------------------------
  31. static float dot(const Vec3& u, const Vec3& v);
  32. static Vec3 cross(const Vec3& u, const Vec3& v);
  33. };
  34. #endif