From 5b23d7cceb813ca636d3e008f9cc15b84963595a Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 25 Feb 2013 08:14:45 +0000 Subject: [PATCH] math: minor code simplification in Box2D/Box3D. --- src/lol/math/geometry.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/lol/math/geometry.h b/src/lol/math/geometry.h index f00a8887..28820419 100644 --- a/src/lol/math/geometry.h +++ b/src/lol/math/geometry.h @@ -47,9 +47,7 @@ struct Box2D Box2D &operator +=(vec2 v) { - A += v; - B += v; - return *this; + return *this = *this + v; } Box2D operator -(vec2 v) @@ -59,9 +57,7 @@ struct Box2D Box2D &operator -=(vec2 v) { - A -= v; - B -= v; - return *this; + return *this = *this - v; } vec2 A, B; @@ -86,9 +82,7 @@ struct Box3D Box3D &operator +=(vec3 v) { - A += v; - B += v; - return *this; + return *this = *this + v; } Box3D operator -(vec3 v) @@ -98,9 +92,7 @@ struct Box3D Box3D &operator -=(vec3 v) { - A -= v; - B -= v; - return *this; + return *this = *this - v; } vec3 A, B;