Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've seen many examples of checking for a rectangle ($A$) intersecting another rectangle ($B$), but I'm developing something where I need to check if $A$ is bisecting (crossing outside of) $B$.

My intersect method returns true if $A$ is completely inside of $B$ and also true if it bisects $B$. I'd like it to return false if $A$ is completely inside of $B$.

Note: $A$ and $B$ could have rotation applied.


share|cite|improve this question
bisect usually means "cut in half" – Henry Jun 22 '11 at 18:01
True, I wasn't sure the technical term for crossing over or overlapping. In everyday usage you can say a road bisects another without the latter ending up in two equal parts. – kreek Jun 22 '11 at 18:20
up vote 1 down vote accepted

You can check whether A is completely inside B by checking if each of the four corners of A is inside B; if so then return false to your original question.

share|cite|improve this answer
For any others looking for how to determine if points are within a rectangle here's where I found the solution – kreek Jun 22 '11 at 20:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.