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

@@ -63,15 +63,15 @@ bool NzCube<T>::Contains(const NzCube<T>& cube) const
}
template<typename T>
NzCube<T>& NzCube<T>::ExtendTo(const NzVector3<T>& point)
NzCube<T>& NzCube<T>::ExtendTo(T X, T Y, T Z)
{
width = std::max(x + width, point.x);
height = std::max(y + height, point.y);
depth = std::max(z + depth, point.z);
width = std::max(x + width, X);
height = std::max(y + height, Y);
depth = std::max(z + depth, Z);
x = std::min(x, point.x);
y = std::min(y, point.y);
z = std::min(z, point.z);
x = std::min(x, X);
y = std::min(y, Y);
z = std::min(z, Z);
width -= x;
height -= y;
@@ -80,6 +80,12 @@ NzCube<T>& NzCube<T>::ExtendTo(const NzVector3<T>& point)
return *this;
}
template<typename T>
NzCube<T>& NzCube<T>::ExtendTo(const NzVector3<T>& point)
{
return ExtendTo(point.x, point.y, point.z);
}
template<typename T>
NzCube<T>& NzCube<T>::ExtendTo(const NzCube& cube)
{