Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Should an AABB "contain" a point when the point is:

  • Exclusive: Only exactly inside the aabb

  • Inclusive: Inside the aabb or exactly on the sides

  • Almost: Inside the aabb or a little bit outside of the sides

eaabbe

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

Ultimately, it comes down to what you commonly check. To bring up a 4th alternative, I've used half-open intervals, so points belong to exactly one bounding box at a tight boundary.

bb.minX <= point.x < bb.maxX
share|improve this answer
add comment

Inclusive, because when setting up containing boxes, if an object passes over the line it will be checked twice where your other methods would, and could easily not check a collision, or check too many and do a lot of extra work.

share|improve this answer
add comment

Your Answer

 
discard

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.