Math/Box|Rect: Fix Intersect method with zero-sized boxes
This commit is contained in:
parent
04a8b03cf3
commit
45d4195527
|
|
@ -464,7 +464,7 @@ namespace Nz
|
||||||
T up = std::max(z, box.z);
|
T up = std::max(z, box.z);
|
||||||
T down = std::min(z + depth, box.z + box.depth);
|
T down = std::min(z + depth, box.z + box.depth);
|
||||||
|
|
||||||
if (left >= right || top >= bottom || up >= down)
|
if (left > right || top > bottom || up > down)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (intersection)
|
if (intersection)
|
||||||
|
|
|
||||||
|
|
@ -366,12 +366,10 @@ namespace Nz
|
||||||
{
|
{
|
||||||
T left = std::max(x, rect.x);
|
T left = std::max(x, rect.x);
|
||||||
T right = std::min(x + width, rect.x + rect.width);
|
T right = std::min(x + width, rect.x + rect.width);
|
||||||
if (left >= right)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
T top = std::max(y, rect.y);
|
T top = std::max(y, rect.y);
|
||||||
T bottom = std::min(y + height, rect.y + rect.height);
|
T bottom = std::min(y + height, rect.y + rect.height);
|
||||||
if (top >= bottom)
|
|
||||||
|
if (left > right || top > bottom)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (intersection)
|
if (intersection)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue