Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bounding Box vs. Rectangle

What is the difference between a Bounding Box and a Rectangle?

This question is specifically about Unity 3D's Bounds and Rect classes, but I am moreso interested in a general answer.

Specifically:

  • Which is better on performance?
  • Is a Bounding Box just a 3D Rectangle?
  • When should I prefer one over the other?
  • Are they interchangeable terms, and if so, why does Unity 3D have separate classes for them?
  • Any other knowledge you can bestow would be greatly appreciated!
like image 303
Evorlor Avatar asked Nov 16 '14 15:11

Evorlor


1 Answers

Which is better on performance?

Irrelevant. They are the same in 2D, and in 3D they have different meaning/use.

Is a Bounding Box just a 3D Rectangle?

There is no such thing as a 3D rectangle. You mean a box. A bounding box is a box that's just large enough to encompass all collidable parts of an entity/model.

When should I prefer one over the other?

Irrelevant, see first paragraph.

Are they interchangeable terms, and if so, why does Unity 3D have separate classes for them?

Again, 2D vs 3D.

Any other knowledge you can bestow would be greatly appreciated!

Bounding boxes exist to improve performance of collision detection. If two body's bounding boxes do not intersect, there is no need to further process any of their colliders or in 2D performing a pixel-perfect intersection test. Bounding boxes allow the collision detection algorithm to quickly discard any guaranteed non-colliding bodies.

like image 114
LearnCocos2D Avatar answered Sep 25 '22 14:09

LearnCocos2D