Add scale operation for regions
This commit is contained in:
parent
0d21857d76
commit
847242a59f
11
region.cpp
11
region.cpp
@ -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>
|
||||
bool
|
||||
region<T>::empty (void) const
|
||||
|
@ -46,6 +46,7 @@ namespace util {
|
||||
|
||||
size_type area (void) const;
|
||||
size_type diameter (void) const;
|
||||
void scale (double factor);
|
||||
|
||||
bool empty (void) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user