diff options
| author | Juan Linietsky <reduzio@gmail.com> | 2015-04-24 16:08:05 -0300 |
|---|---|---|
| committer | Juan Linietsky <reduzio@gmail.com> | 2015-04-24 16:08:05 -0300 |
| commit | 7006fe3cc4580b2ece75681c0adc1ab6ab27891a (patch) | |
| tree | 2ae9b2079ae0c252e270bc058cc2c473c8dc8ef3 /core/math/math_2d.h | |
| parent | 4fb905ed29357a57933f796b1478a4f874b83c05 (diff) | |
| download | redot-engine-7006fe3cc4580b2ece75681c0adc1ab6ab27891a.tar.gz | |
Corrected rectangle intersection, fixes #1731
Diffstat (limited to 'core/math/math_2d.h')
| -rw-r--r-- | core/math/math_2d.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 3691ab75b9..ac315fddb7 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -214,13 +214,13 @@ struct Rect2 { float get_area() const { return size.width*size.height; } inline bool intersects(const Rect2& p_rect) const { - if ( pos.x > (p_rect.pos.x + p_rect.size.width) ) + if ( pos.x >= (p_rect.pos.x + p_rect.size.width) ) return false; - if ( (pos.x+size.width) < p_rect.pos.x ) + if ( (pos.x+size.width) <= p_rect.pos.x ) return false; - if ( pos.y > (p_rect.pos.y + p_rect.size.height) ) + if ( pos.y >= (p_rect.pos.y + p_rect.size.height) ) return false; - if ( (pos.y+size.height) < p_rect.pos.y ) + if ( (pos.y+size.height) <= p_rect.pos.y ) return false; return true; |
