Vector.cpp 563 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "Vector.h"
  2. Vec3f::Vec3f(float x, float y, float z)
  3. {
  4. this->x = x;
  5. this->y = y;
  6. this->z = z;
  7. }
  8. Vec3f::Vec3f()
  9. {
  10. this->x = 0;
  11. this->y = 0;
  12. this->z = 0;
  13. }
  14. Vec3f::Vec3f(Vec3f &other)
  15. {
  16. this->x = other.x;
  17. this->y = other.y;
  18. this->z = other.z;
  19. }
  20. float& Vec3f::operator [](int index)
  21. {
  22. return v[index];
  23. }
  24. Vec2f::Vec2f(float x, float y)
  25. {
  26. this->x = x;
  27. this->y = y;
  28. }
  29. Vec2f::Vec2f()
  30. {
  31. this->x = 0;
  32. this->y = 0;
  33. }
  34. Vec2f::Vec2f(Vec2f &other)
  35. {
  36. this->x = other.x;
  37. this->y = other.y;
  38. }
  39. float& Vec2f::operator [](int index)
  40. {
  41. return v[index];
  42. }