diff --git a/src/lol/math/geometry.h b/src/lol/math/geometry.h index 1b410ba0..d4244948 100644 --- a/src/lol/math/geometry.h +++ b/src/lol/math/geometry.h @@ -51,27 +51,32 @@ template struct Box2 B(T(0)) {} - inline Box2(Vec2 a, Vec2 b) + inline Box2(Vec2 const &a, Vec2 const &b) : A(a), B(b) {} - Box2 operator +(Vec2 v) + inline Box2(T const &ax, T const &ay, T const &bx, T const &by) + : A(ax, ay), + B(bx, by) + {} + + Box2 operator +(Vec2 const &v) { return Box2(A + v, B + v); } - Box2 &operator +=(Vec2 v) + Box2 &operator +=(Vec2 const &v) { return *this = *this + v; } - Box2 operator -(Vec2 v) + Box2 operator -(Vec2 const &v) { return Box2(A - v, B - v); } - Box2 &operator -=(Vec2 v) + Box2 &operator -=(Vec2 const &v) { return *this = *this - v; } @@ -90,27 +95,33 @@ template struct Box3 B(T(0)) {} - inline Box3(Vec3 a, Vec3 b) + inline Box3(Vec3 const &a, Vec3 const &b) : A(a), B(b) {} - Box3 operator +(Vec3 v) + inline Box3(T const &ax, T const &ay, T const &az, + T const &bx, T const &by, T const &bz) + : A(ax, ay, az), + B(bx, by, bz) + {} + + Box3 operator +(Vec3 const &v) { return Box3(A + v, B + v); } - Box3 &operator +=(Vec3 v) + Box3 &operator +=(Vec3 const &v) { return *this = *this + v; } - Box3 operator -(Vec3 v) + Box3 operator -(Vec3 const &v) { return Box3(A - v, B - v); } - Box3 &operator -=(Vec3 v) + Box3 &operator -=(Vec3 const &v) { return *this = *this - v; }