Add scale operation for regions

This commit is contained in:
Danny Robson 2013-07-30 23:51:55 +10:00
parent 0d21857d76
commit 847242a59f
2 changed files with 12 additions and 0 deletions

View File

@ -67,6 +67,17 @@ region<T>::diameter (void) const {
} }
template <typename T>
void
region<T>::scale (double factor) {
x -= (w * factor - w) / 2.0;
y -= (h * factor - h) / 2.0;
w *= factor;
h *= factor;
}
template <typename T> template <typename T>
bool bool
region<T>::empty (void) const region<T>::empty (void) const

View File

@ -46,6 +46,7 @@ namespace util {
size_type area (void) const; size_type area (void) const;
size_type diameter (void) const; size_type diameter (void) const;
void scale (double factor);
bool empty (void) const; bool empty (void) const;