summaryrefslogtreecommitdiff
path: root/source/math.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/math.h')
-rwxr-xr-xsource/math.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/math.h b/source/math.h
index 950593d..ff76c0e 100755
--- a/source/math.h
+++ b/source/math.h
@@ -8,7 +8,7 @@
#define TO_RAD(x) ((x) * PI / 180.0f)
#define TO_DEG(x) ((x) * 180.0f / PI)
#define ABS(x) ((x) < 0 ? (-(x)) : (x))
-#define MIN(x,y) ((x) < (y) ? (y) : (x))
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
// @todo:
// - make everything simd
@@ -176,6 +176,15 @@ union Vec2 {
return res;
}
+
+ Vec2 operator/(Vec2 v) {
+ SDL_assert(v.x != 0 && v.y != 0);
+ Vec2 res;
+ res.x = this->x / v.x;
+ res.y = this->y / v.y;
+
+ return res;
+ }
};
union Vec3 {