From 79a83c2cbee5adca798b8976b2a39ecd6ffd39af Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sat, 2 Feb 2019 23:02:12 -0500 Subject: initial commit basic B field integrator --- vec3.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 vec3.h (limited to 'vec3.h') diff --git a/vec3.h b/vec3.h new file mode 100644 index 0000000..1f01098 --- /dev/null +++ b/vec3.h @@ -0,0 +1,27 @@ +#include +class vec3 { + public: + double v[3]; + public: + vec3(); + vec3(double x); + vec3(double x, double y, double z); + double &operator[](int index); + double operator[](int index) const; + vec3 operator*(double scale) const; + vec3 operator/(double scale) const; + vec3 operator+(const vec3 &other) const; + vec3 operator-(const vec3 &other) const; + vec3 operator-() const; + const vec3 &operator*=(double scale); + const vec3 &operator/=(double scale); + const vec3 &operator+=(const vec3 &other); + const vec3 &operator-=(const vec3 &other); + double magnitude() const; + double magnitudeSquared() const; + vec3 normalize() const; + double dot(const vec3 &other) const; + vec3 cross(const vec3 &other) const; +}; + +std::ostream &operator<<(std::ostream &output, const vec3 &v); -- cgit v1.1