Note, I did not really read your code, I stopped when I realized you were using
as a clever form of 0
However, you can problem take an approach similar to this:
1. Start off assuming that the circle is completely inside the rectangle
2. For each side of the rectangle calculate the 2d line that represents its edge.
3. Compute the signed distance from the center of the circle to the edge's line, where a positive distance is towards the inside of the box and a negative distance is outside the box (this can be found online somewhere easily enough).
4. If the distance is < -radius, you know the circle is completely outside of the box (because its not on the inside of all edges).
5. If the distance is between [-radius, radius], the circle intersects the edge so you can change your assumption to just an intersection
6. After you've checked all planes, you're either inside or intersecting (since outside would have returned early).
I think this should work pretty well, but there may be some corner cases where it's possible to get a true intersection when it's not actually intersecting.