1
$\begingroup$

This is a question regarding how to calculate the area of a circle occupied by a rectangle when that rectangle is larger than the circle (see this link for a example image http://i57.tinypic.com/30297hh.jpg). I made a first post here: Area of Circle Overlapped by Rectangle, where "achille hui" was nice enough to point out a way of calculating this value.

However, I have noticed that when the radius of the circle is very close to half the width of the rectangle, a smaller circle actually means the final percentage value is smaller (which should not be the case, correct?).

Examples:

With a rectangle of $2$ units tall and $0.8$ units wide, using the formula:

percentage = $(((2*(\text{diameter}) + (2*\sqrt{\text{radius}^2 - 0.4^2} ) ) / 3) * 0.8) / (\pi*\text{radius}^2)$

) A circle with radius $0.810687473$ yields a result of: $0.60096155$, ~$60.1$%.

) A circle with radius $0.436310160932088$ yields a result of: $0.933587972813617$, ~$93.4$%.

) Yet a circle with radius $0.414496705$ yields a result of: $0.926510065$, ~$92.7$%. Shouldn't this percentage be higher?

So I'm not sure how to account for this (and to be honest don't understand why this is happening). Though I think when the radius of the circle is equal to or less than the width of the rectangle the area covered should be 100% (in this case, am I correct?). Any ideas area appreciated, thank you for reading.

$\endgroup$
  • $\begingroup$ I haven't checked the linked answer - but I do note that the author says in several places that he's made some approximations. Those may well be a little off in extreme cases like the one you encountered. I doubt that the discrepancy you note can really make a difference in the game context you care about. $\endgroup$ – Ethan Bolker Jun 17 '15 at 18:13
  • $\begingroup$ Its a fair point you make, though I wouldn't write off losing all accuracy after ~93% as trivial. But really I'm just more curious about how to do it, rather than it being a 'make or break' factor in a in-game situation. Just curious about math. $\endgroup$ – Joe Jun 17 '15 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.