From a946b182f9e4d0fd3018eacd03d0599838f45528 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 15 Apr 2015 17:16:34 +1000 Subject: [PATCH] aabb: add diameter method --- aabb.cpp | 9 +++++++++ aabb.hpp | 1 + 2 files changed, 10 insertions(+) diff --git a/aabb.cpp b/aabb.cpp index 3bb07aac..c18a0699 100644 --- a/aabb.cpp +++ b/aabb.cpp @@ -30,6 +30,15 @@ AABB::AABB (point _p0, point _p1): } +//----------------------------------------------------------------------------- +template +T +AABB::diameter (void) const +{ + return magnitude ().diameter (); +} + + //----------------------------------------------------------------------------- template util::extent diff --git a/aabb.hpp b/aabb.hpp index 2715c65f..01d51881 100644 --- a/aabb.hpp +++ b/aabb.hpp @@ -30,6 +30,7 @@ namespace util { AABB () = default; AABB (point, point); + T diameter (void) const; extent magnitude (void) const; bool overlaps (point) const;