Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Finding super-AABB that encloses two smaller AABB's

This topic is 5389 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is most efficient way to find super-AABB (dashed box) that encloses two smaller AABB''s which have origins at points p1 and p2?

| +- - - - - - +---+
| .  p1        | o | p2
| +-----+      +---+
| |  o  |          .
| +-----+ - - - - -+
+------------------> x

To compute this, should AABB object have it''s min and max vector stored relative to world origin (absolute) or relative to it''s local origin?

Share this post

Link to post
Share on other sites
AABBoxes with min and max absolute vectors are usually the way to go. Then it''s a straight forward procedure

SuperBox.MinX = (Box1.MinX < Box2.MinX)? Box1.MinX : Box2.MinX;
SuperBox.MinY = (Box1.MinY < Box2.MinY)? Box1.MinY : Box2.MinY;
SuperBox.MinZ = (Box1.MinZ < Box2.MinZ)? Box1.MinZ : Box2.MinZ;

SuperBox.MaxX = (Box1.MaxX > Box2.MaxX)? Box1.MaxX : Box2.MaxX;
SuperBox.MaxY = (Box1.MaxY > Box2.MaxY)? Box1.MaxY : Box2.MaxY;
SuperBox.MaxZ = (Box1.MaxZ > Box2.MaxZ)? Box1.MaxZ : Box2.MaxZ;

if your boxes are based on a centre postion and an extent, then compute the min and max of both boxes and do the thing above.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!