Sign in to follow this  
havythoai

How to create the bounding box ?

Recommended Posts

Dear everybody, First, I thank everybody for Frenet frame topics that help me create successfully the swept surface. Second,I'm doing the NC machining simulator, now the next work is that I have to take the swept surface to intersect stock (representing by Z vectors). My swept surface is series of triangles, and I have known the algorithm of Ray - Triangle intersection. The problem I got is that how to create a bounding box around a given triangle so that Z vectors which in bounding box would be taken to intersect with that triangle, but it don't take the Z vectors outside the bounding box to do. here is the picture http://upload.tinhco.net/thoai/boundingbox.JPG I never do this before, so the term "bounding box" is new to me. Is there any idea ? or a similiar example code would be nice \:D please, help me \:\)

Share this post


Link to post
Share on other sites
If you want an axis-aligned bounding box the easiest way is to get the minimum and maximum vectors from the triangle's vertices.

Example:

min.x = min(v1.x, v2.x, v3.x);
....

If you need the bounding box to be aligned with the axes of the stacks coordinate system, you could transform the triangle into this coordinate system if it doesn't correspond to the world's coordinate system.

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