I'm trying to wrap my head around 2D physics and stumbled upon Axis Aligned Bounding Boxes, and I have a couple of questions regarding them.

In all AABB structs I could find out there, people prefer naming their AABB vectors: LowerBounds & UpperBounds, or Max & Min. What do those values actually represent?

Is LowerBound the x and y of a rectangle and UpperBound x+width, y+height? If so, why not call them TopLeft & BottmRight? (since a boundary isn't a point) Same thing with max & min, the naming makes no sense to me.

The other question is: In every AABB collision detection guide out there people seem to present two AABB boxes, and call the the first one A, and the second one B, almost like an AABB doesn't even represent a box.

Could someone show me how to make a AABB box, out of a Rectangle (x,y,width,height)? That would clarify a lot for me.

  • \$\begingroup\$ Not really an answer, but there are source of concentrated knowledge, that will answer all your questions about collision detection and bounding volumes: Real-Time Collision Detection (Christer Ericson). Hurry, ask Santa for it! ;) \$\endgroup\$ – Ivan Aksamentov - Drop Dec 25 '13 at 19:09
  • \$\begingroup\$ It's a book about 3D, Not quite there yet :( \$\endgroup\$ – BjarkeCK Dec 25 '13 at 19:21

The primary difference is how they're used and how they're expected to respond. For example, AABBs do not rotate, rectangles are allowed to. You're right, they're very similar and you could use a rectangle like an AABB if you applied some restrictions to it. AABBs are essentially rectangles that are always positioned to be aligned with the axes of the world. When you can make the assumption that none of your bounds are rotated, this makes many things simpler with algorithms for collision detection.

The reason for the way the properties are named is because of the way it's used. AABBs are used for bounding, thus the properties describe the bounds, and so are called UpperBound and LowerBound. Yes, they're points. You need two values to define bounds on any given axis. The LowerBound contains the minimum values for the x and y axis, and the UpperBound contains the maximum values for the x and y axis.

The reason for naming the two AABBs A and B is just preference. Typically in these scenarios, you just have two objects, where (usually) the order you compare them isn't particularly important. A and B are arbitrary names.

Typically the LowerBound does equal the x and y of a rectangle and UpperBound equals the x+width and y+height of the rectangle. As long as the width and height are positive numbers.

  • \$\begingroup\$ So the "LowerBound", is visually the UpperBounderie, and it's not even a bounderie it's a point... It still doesnt make sence for me, but i guess i just need to accept that, that is the way it is, maybe it will make sence to me later on :) But thank you alot for clarifying! \$\endgroup\$ – BjarkeCK Dec 25 '13 at 20:02
  • \$\begingroup\$ No the upper bound is also visually the upper bound. Yes try it out and it'll make more sense. As I said, the binder for a single axis is just one number, so a point is all you need to define an upper boundary on two axes. \$\endgroup\$ – MichaelHouse Dec 25 '13 at 20:13

Speaking to the naming part, left/right up/down are avoided because they are expressions of relative direction, whereas AABB's are concerned with operations which are rotationally invariant. For practical purposes, you could consider the invariant frame of reference to be your computer screen, which may be intuitively be visualized as having up/down directions corresponding with the Y axis and left/right directions corresponding to the X axis. However, this expresses directions as seen from the perspective of the observer, and is only intuitive because you wouldn't observe your screen from behind your monitor.

To further complicate the issue, AABBs are also used in 3-dimensions, where there are differing conventions. In some coordinate system implementations, positive x represents "right", and in others it represents "left". Worse yet, some 3D systems consider Y to represent up/down, while others use Z for up/down.


Your Answer

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

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