File indexing completed on 2024-05-12 03:47:30
0001 #ifndef VECTOR3D_H 0002 #define VECTOR3D_H 0003 0004 #include <array> 0005 0006 // QVector3D uses only floats not doubles 0007 // Especially for datetimes this is critical 0008 class Vector3D { 0009 public: 0010 Vector3D(double x = 0, double y = 0, double z = 0) { 0011 v[0] = x; 0012 v[1] = y; 0013 v[2] = z; 0014 } 0015 double x() const { 0016 return v[0]; 0017 } 0018 double y() const { 0019 return v[1]; 0020 } 0021 double z() const { 0022 return v[2]; 0023 } 0024 0025 void setX(double x) { 0026 v[0] = x; 0027 } 0028 void setY(double y) { 0029 v[1] = y; 0030 } 0031 void setZ(double z) { 0032 v[2] = z; 0033 } 0034 0035 inline const Vector3D operator-(const Vector3D& other) const { 0036 return Vector3D(v[0] - other.v[0], v[1] - other.v[1], v[2] - other.v[2]); 0037 } 0038 0039 private: 0040 std::array<double, 3> v; 0041 }; 0042 0043 #endif // VECTOR3D_H