Sign in to follow this  
ebikhan

Object Bounding Box(OBB)

Recommended Posts

Hello ! I want to create an application for learning purposes. I will be implementing a collision detection in it. I have gone through the Advanced Collision Detection on this forum. However I have many confusions :) .. Right now I want to concentrate on first one. How will I create a bounding box for a polygon. Any explanation with examples or tutorial on it for be greatly appreciated. and Is it applicable only for triangles i.e. I have to create my polygon from triangles ??? Thanks, Best Regards

Share this post


Link to post
Share on other sites
Quote:
I want to create an application for learning purposes. I will be implementing a collision detection in it. I have gone through the Advanced Collision Detection on this forum. However I have many confusions :) .. Right now I want to concentrate on first one. How will I create a bounding box for a polygon. Any explanation with examples or tutorial on it for be greatly appreciated. and Is it applicable only for triangles i.e. I have to create my polygon from triangles ???
I'm not completely clear on your question, but usually bounding boxes are more useful for meshes or other grouped geometry. If I were trying to, say, pick polygons on screen using ray intersection, I wouldn't bother making a bounding box for each poly, but rather would just do a ray-poly test directly. (This is setting aside the issue of broad-phase culling.)

I'm not sure what you mean by creating a polygon from triangles. From a collision detection perspective, you can deal with all sorts of primitives, including arbitrary convex and concave polygons. For rendering, polygons usually get converted into triangles eventually.

You might provide some more information. For example, what kind of collision detection do you want to do? Ray-polygon picking? Between two polygons? Etc.

Share this post


Link to post
Share on other sites
Well to build a tree, gotta find the convex hull of the whole model, thats basically getting the extreme points for each PLANE your testing on. Now it depends on what bounding volume you use of course. Lets say u have a cloud of points and u need to find the right most plane. Well which ever point within the cloud has the highest x value would be the used as the plane for that boundry....so basically loop thru all points storing the extreme points. and when all done u have the points, then u have to find the distance..... I would start with an amazon search on collision detection books. Just follow on u'r own from there.

Good luck man

Share this post


Link to post
Share on other sites
Thanx for the help but wud give better results ??? Will it not be good to break the polygon just what is done in creating OBBs ... I want tutorial that how we create it . Can u please help me in it ?

and Amazon searching the books ... it will take time when I get the book ... rite :P ? Anyways thanx for the help

Share this post


Link to post
Share on other sites
No material I can think of, but this is how you would do it...


for(int i < num_points,i++) {

maxy = maxx = maxz = -9999999 somthing really small
minu = minx = minz = 99999999 somthing really big

if point[i].x > maxx
maxx = i //save the index
else point[i].x < minx
minx = i //save the index

same thing for all other axis...y,z

}

Loops finished and u have the extreme points of the box. now since these planes have a normal on 1, these are also the distance. Other wise u would have todo a dot product. Now to detect if somthing collides, I just posted that on someone elses post. and voila....now this is JUST the convex hull to be really good u make a heirarchy tree! I gotta go for now, I'll come back and see where this convo left off

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this