X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Frect.h;h=7a0f1e1e286a134cda959cb5be7ec3778886443e;hp=3c4a105b664b23e66a3eeba9163b052af554f290;hb=3837f6a4e6ade33b9c57b1207f9f0774212c29b5;hpb=0b655cc25b8ed09752296e4df67e7adcec5a5003 diff --git a/src/rect.h b/src/rect.h index 3c4a105..7a0f1e1 100644 --- a/src/rect.h +++ b/src/rect.h @@ -26,6 +26,15 @@ namespace IPDF if (pt_y >= y + h) return false; return true; } + + inline bool Intersects(const Rect& other) const + { + if (x + w < other.x) return false; + if (y + h < other.y) return false; + if (x > other.x + other.w) return false; + if (y > other.y + other.h) return false; + return true; + } }; inline Rect TransformRectCoordinates(const Rect& view, const Rect& r)