diff --git a/include/Nazara/Math/Cube.hpp b/include/Nazara/Math/Cube.hpp index f6a2fd059..db43a231a 100644 --- a/include/Nazara/Math/Cube.hpp +++ b/include/Nazara/Math/Cube.hpp @@ -29,6 +29,7 @@ class NzCube bool Contains(const NzVector3& point) const; bool Contains(const NzCube& cube) const; + NzCube& ExtendTo(T X, T Y, T Z); NzCube& ExtendTo(const NzVector3& point); NzCube& ExtendTo(const NzCube& cube); @@ -71,7 +72,7 @@ class NzCube }; template -std::ostream& operator<<(std::ostream& out, const NzCube& vec); +std::ostream& operator<<(std::ostream& out, const NzCube& cube); typedef NzCube NzCubed; typedef NzCube NzCubef; diff --git a/include/Nazara/Math/Cube.inl b/include/Nazara/Math/Cube.inl index 7e0ad40b1..48cb38b2a 100644 --- a/include/Nazara/Math/Cube.inl +++ b/include/Nazara/Math/Cube.inl @@ -63,15 +63,15 @@ bool NzCube::Contains(const NzCube& cube) const } template -NzCube& NzCube::ExtendTo(const NzVector3& point) +NzCube& NzCube::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& NzCube::ExtendTo(const NzVector3& point) return *this; } +template +NzCube& NzCube::ExtendTo(const NzVector3& point) +{ + return ExtendTo(point.x, point.y, point.z); +} + template NzCube& NzCube::ExtendTo(const NzCube& cube) { diff --git a/include/Nazara/Math/Rect.hpp b/include/Nazara/Math/Rect.hpp index bbf09152c..ca5c7b04d 100644 --- a/include/Nazara/Math/Rect.hpp +++ b/include/Nazara/Math/Rect.hpp @@ -26,6 +26,7 @@ class NzRect bool Contains(const NzVector2& point) const; bool Contains(const NzRect& rect) const; + NzRect& ExtendTo(T X, T Y); NzRect& ExtendTo(const NzVector2& point); NzRect& ExtendTo(const NzRect& rect); @@ -66,7 +67,7 @@ class NzRect }; template -std::ostream& operator<<(std::ostream& out, const NzRect& vec); +std::ostream& operator<<(std::ostream& out, const NzRect& rect); typedef NzRect NzRectd; typedef NzRect NzRectf; diff --git a/include/Nazara/Math/Rect.inl b/include/Nazara/Math/Rect.inl index 44b88e05a..2b8fe040f 100644 --- a/include/Nazara/Math/Rect.inl +++ b/include/Nazara/Math/Rect.inl @@ -56,13 +56,13 @@ bool NzRect::Contains(const NzRect& rect) const } template -NzRect& NzRect::ExtendTo(const NzVector2& point) +NzRect& NzRect::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& NzRect::ExtendTo(const NzVector2& point) return *this; } +template +NzRect& NzRect::ExtendTo(const NzVector2& point) +{ + return ExtendTo(point.x, point.y); +} + template NzRect& NzRect::ExtendTo(const NzRect& rect) {