//
you're reading...
Tech

Creating A Bounding Box In OpenGL

A bounding box, assuming it’s a sphere, contains two elements only: the center and the radius of the sphere. So for any given object, if you know these two elements, you have the bounding box.

Usually, (0, 0, 0) can be roughly seen as the center but you can take it serious – the center is a point where the vectors from each point to it sums up to zero vector.

As to the radius, it could roughly be defined as the largest magnitude of each components of each vertices (hence the making the minimum sphere to contain the object).

Once you have these two parameters, you can always tell whether two given objects are touching or intersecting by calculating the distance between the centers and comparing it to the sum of radii.

Advertisements

About Xiang 'Anthony' Chen

Making an Impact in Your Life

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Twitter Updates

%d bloggers like this: