From 932f7a4ec38e3b4a8d7dcc500bfeb3ce9d488d44 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 4 Jun 2012 14:51:25 +1000 Subject: [PATCH] Add aspect query for extent --- extent.cpp | 6 ++++++ extent.hpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/extent.cpp b/extent.cpp index cc3bb28a..e03d871b 100644 --- a/extent.cpp +++ b/extent.cpp @@ -47,6 +47,12 @@ extent::area (void) const { return width * height; } +template +double +extent::aspect (void) const + { return static_cast (width) / height; } + + template bool extent::empty (void) const diff --git a/extent.hpp b/extent.hpp index 322193ca..d8996a10 100644 --- a/extent.hpp +++ b/extent.hpp @@ -33,6 +33,8 @@ namespace util { T area (void) const; T diameter (void) const; + double aspect (void) const; + bool empty (void) const; bool operator ==(const extent& rhs) const;