How to create the bounding box ?

Started by
0 comments, last by Lord_Evil 16 years, 3 months ago
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 \:\)
Advertisement
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.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!

This topic is closed to new replies.

Advertisement