diff --git a/region.cpp b/region.cpp index 9ca19a9b..38008f67 100644 --- a/region.cpp +++ b/region.cpp @@ -67,6 +67,17 @@ region::diameter (void) const { } +template +void +region::scale (double factor) { + x -= (w * factor - w) / 2.0; + y -= (h * factor - h) / 2.0; + + w *= factor; + h *= factor; +} + + template bool region::empty (void) const diff --git a/region.hpp b/region.hpp index 231d23ea..73cd3011 100644 --- a/region.hpp +++ b/region.hpp @@ -46,6 +46,7 @@ namespace util { size_type area (void) const; size_type diameter (void) const; + void scale (double factor); bool empty (void) const;