I’ve tried to create a rectangle class and check if two rectangles intersect. Their x and y values represent the centers. My intersection condition looks like this:
r1.x+r1.w/2 < r2.x-r2.w/2 || r2.x+r2.w/2 < r1.x-r1.w/2 ||
r1.y-r1.h/2 < r2.y+r2.h/2 || r2.y-r2.h/2 < r1.y+r1.h/2
but for some reason, it always returns true. I would highly appreciate it if you can help me find the mistake.
Thanks in advance