View Full Version : Boundry Boxes
03-12-2007, 01:18 AM
I want to have boundry boxes (visble cubic wireframes) around certain polygon models.
Would It be more efficent to create it when developing the models, or to calculate it at runtime?
I also eventually want to create handles so I can rotate translate etc using the boundry box
03-12-2007, 03:40 AM
If the objects don't change during execution of your program you should definately precompute the bounding boxes. There are two main types of bounding boxes out there. The simplest is the axis aligned bounding box (AABB). It is simple the models min and max for each world axis, typically X, Y and Z. This is often not optimal though. By creating local object axis and computing min and max along these it is often possible to get a tighter fit, which is always desirable. The latter on is often referred to as object aligned bounding box (OABB).
I suggest you go with AABB to start with since it is much easier to implement. Simply keep track of the min and max in each dimension as you read the model from file. If you don't read it this way, just iterate over the vertices and keep track of min, max.
For both techniques the bounding box has 8 vertices. These can easily be rendered as a transparent cube, or wireframe.
When the model "moves" you can update the vertices of the bounding box using the same transformation matrix.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.