From a8bcacc95045102e67f2feabbdddf79535837554 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Thu, 19 Aug 2021 18:46:51 +0200 Subject: forgot to make repo until now --- umath/intersect.h | 6 ++++++ umath/vec2.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 umath/intersect.h create mode 100644 umath/vec2.h (limited to 'umath') diff --git a/umath/intersect.h b/umath/intersect.h new file mode 100644 index 0000000..1cb1923 --- /dev/null +++ b/umath/intersect.h @@ -0,0 +1,6 @@ +#ifndef INTERSECT_H +#define INTERSECT_H + +bool intersect_ + +#endif \ No newline at end of file diff --git a/umath/vec2.h b/umath/vec2.h new file mode 100644 index 0000000..ee72143 --- /dev/null +++ b/umath/vec2.h @@ -0,0 +1,33 @@ +#ifndef VEC2_H +#define VEC2_H + +class vec2 { + public: + float x; + float y; + + vec2() : x(0), y(0) {}; + vec2(float x, float y) : x(x), y(y) {}; + + vec2(const vec2 &oth) { x = oth.x; y = oth.y; }; + vec2(vec2 &oth) { x = oth.x; y = oth.y; }; + + vec2 operator+(const vec2 &rhs) { + return vec2 { x + rhs.x, y + rhs.y }; + } + vec2 operator-(const vec2 &rhs) { + return vec2 { x - rhs.x, y - rhs.y }; + } + vec2 operator*(const float m) { + return vec2 { x * m, y * m }; + } + vec2 operator/(const float m) { + return vec2 { x / m, y / m }; + } + vec2 operator+=(vec2 oth) { x += oth.x; y += oth.y; } + vec2 operator-=(vec2 oth) { x -= oth.x; y -= oth.y; } + vec2 operator*=(float m) { x *= m; y *= m; } + vec2 operator/=(float m) { x /= m; y /= m; } +}; + +#endif \ No newline at end of file -- cgit v1.2.3-54-g00ecf