vector3.h 541 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef VECTOR3_H
  2. #define VECTOR3_H
  3. #include <string>
  4. struct Vector3{
  5. float x = 0;
  6. float y = 0;
  7. float z = 0;
  8. Vector3(float x1, float y1, float z1) : x(x1), y(y1), z(z1)
  9. {}
  10. Vector3(){};
  11. Vector3(std::string x1, std::string y1, std::string z1):
  12. x(std::stof(x1)), y(std::stof(y1)), z(std::stof(z1))
  13. {}
  14. Vector3 operator-(Vector3 &rhs);
  15. Vector3& normalized();
  16. float length();
  17. Vector3 crossProduct(Vector3 &rhs);
  18. float dotProduct(Vector3 &rhs);
  19. void print();
  20. };
  21. #endif