diff --git a/extent.cpp b/extent.cpp index 0ff56eb2..847424f6 100644 --- a/extent.cpp +++ b/extent.cpp @@ -66,6 +66,19 @@ extent::area (void) const { return w * h; } +//----------------------------------------------------------------------------- +template +extent +extent::expanded (util::vector<2,T> size) const +{ + return { + w + size.x, + h + size.y + }; +} + + + //----------------------------------------------------------------------------- template float diff --git a/extent.hpp b/extent.hpp index 866bb7ff..f0da514c 100644 --- a/extent.hpp +++ b/extent.hpp @@ -20,6 +20,8 @@ #ifndef __UTIL_EXTENT_HPP #define __UTIL_EXTENT_HPP +#include "vector.hpp" + #include namespace util { @@ -37,6 +39,8 @@ namespace util { T area (void) const; T diameter (void) const; + extent expanded (util::vector<2,T>) const; + float aspect (void) const; bool empty (void) const;