Added [Cube|Rect]::ExtendTo(X, Y[, Z]);

Former-commit-id: 6f3a92644acd818f94088347cc6f1be939adb7f9
This commit is contained in:
Lynix
2013-02-19 01:10:47 +01:00
parent 8fff32e145
commit 49cdbc3c47
4 changed files with 28 additions and 14 deletions

View File

@@ -56,13 +56,13 @@ bool NzRect<T>::Contains(const NzRect<T>& rect) const
}
template<typename T>
NzRect<T>& NzRect<T>::ExtendTo(const NzVector2<T>& point)
NzRect<T>& NzRect<T>::ExtendTo(T X, T Y)
{
width = std::max(x + width, point.x);
height = std::max(y + height, point.y);
width = std::max(x + width, X);
height = std::max(y + height, Y);
x = std::min(x, point.x);
y = std::min(y, point.y);
x = std::min(x, X);
y = std::min(y, Y);
width -= x;
height -= y;
@@ -70,6 +70,12 @@ NzRect<T>& NzRect<T>::ExtendTo(const NzVector2<T>& point)
return *this;
}
template<typename T>
NzRect<T>& NzRect<T>::ExtendTo(const NzVector2<T>& point)
{
return ExtendTo(point.x, point.y);
}
template<typename T>
NzRect<T>& NzRect<T>::ExtendTo(const NzRect& rect)
{