From 241ad65df9c086dfffd6e6f59dbf6904aab78084 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 13 Apr 2015 16:44:30 +1000 Subject: [PATCH] aabb: add equality operator --- aabb.cpp | 12 +++++++++++- aabb.hpp | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/aabb.cpp b/aabb.cpp index d88d0f02..de8fcdd7 100644 --- a/aabb.cpp +++ b/aabb.cpp @@ -170,7 +170,7 @@ AABB::cover (point p) } -//----------------------------------------------------------------------------- +/////////////////////////////////////////////////////////////////////////////// template AABB AABB::operator+ (vector v) const @@ -188,6 +188,16 @@ AABB::operator- (vector v) const } +/////////////////////////////////////////////////////////////////////////////// +template +bool +AABB::operator== (const AABB rhs) const +{ + return rhs.p0 == p0 && rhs.p1 == p1; +} + + + //----------------------------------------------------------------------------- namespace debug { template diff --git a/aabb.hpp b/aabb.hpp index 87c949d1..d9d4ba01 100644 --- a/aabb.hpp +++ b/aabb.hpp @@ -54,6 +54,8 @@ namespace util { AABB operator+ (vector) const; AABB operator- (vector) const; + bool operator== (AABB) const; + point p0; point p1; };