diff options
author | Julian T <julian@jtle.dk> | 2021-01-12 18:48:40 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-01-12 18:48:40 +0100 |
commit | 8251be3e7ec0e381391c951fd4c8f1ab8080bef9 (patch) | |
tree | 8caaf285d59fadb3fb4ce6f3a4c9e1d956d8e21e /src/core/vector.hpp | |
parent | 0f9e88ccf0510ab4d830529fa539ef6db715f988 (diff) |
Reorgranize source file structure
Diffstat (limited to 'src/core/vector.hpp')
-rw-r--r-- | src/core/vector.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/vector.hpp b/src/core/vector.hpp new file mode 100644 index 0000000..20e8210 --- /dev/null +++ b/src/core/vector.hpp @@ -0,0 +1,33 @@ +#ifndef VECTOR_H +#define VECTOR_H + +#include <iostream> + +class Vec3d { + public: + Vec3d(); + Vec3d(double x, double y, double z); + + void set(double x, double y, double z); + void normalize(); + + double length() const; + double dot(const Vec3d &vec) const; + + Vec3d cross(const Vec3d &vec) const; + + // Operators + Vec3d operator+(const Vec3d &vec) const; + Vec3d& operator+=(const Vec3d &vec); + Vec3d operator-(const Vec3d &vec) const; + Vec3d operator-() const; + Vec3d operator*(double) const; + Vec3d operator*(const Vec3d &vec) const; + Vec3d operator/(double) const; + + friend std::ostream& operator<<(std::ostream& os, const Vec3d &v); + + double m_x, m_y, m_z; +}; + +#endif |