   Bounding Boxes
  HowzitHow do I calculate the bounding box of a model that I have imported? I''ve searched on google but can''t find anything substantial.Shot 
  Mesh is an array ov VertexesVertex v;Vertex Min;Vertex Max;Min = Mesh[0];Max = Mesh[0];for(j = 1; j < NumVerts; j++){if(Mesh[j].x < Min.x) Min.x = Mesh[j].x;if(Mesh[j].y < Min.y) Min.y = Mesh[j].y;if(Mesh[j].z < Min.z) Min.z = Mesh[j].z;if(Mesh[j].x > Max.x) Max.x = Mesh[j].x;if(Mesh[j].y > Max.y) Max.y = Mesh[j].y;if(Mesh[j].z > Max.z) Max.z = Mesh[j].z;}  now Min and Max define a Bounding Box(edit) Stupid italics   [edited by - Ximmer on January 27, 2004 3:06:29 AM];  Looks simple enough.Just one thing, does that mesh contain all the vertexes for all the meshes, or will I have to do that for every mesh?   [edited by - Mr_Ridd on January 27, 2004 3:31:25 AM];  The Mesh would contain all the Vertecies for what your trying to make the bounding box for.also that only makes 2 corners of the box but you should be able to get the other corners from that ;  You can define a bounding box with a convex hull ;  How do you do that and what is a convex hull?  ;  don't worry about convex hulls  a simple box, defined by 2 points, is as simple as it gets. It's something you can use for simple collision detection.and if you want, you can make boxes for sub parts of the model. The algorithm above builds a box around the list of vertices you supply, so you can supply anything, and it will build a box around it.    [edited by - oliii on January 27, 2004 6:49:26 AM];  I did what is above and Max and Min ended up to be the same values. ;  you must have done something wrong in the signs, or using the ''j'' parameter.unless your number of vertices is <= 1.  ;  oliii, know something about any other kind of bounding box?the bounding box must >= convex hull of the vertices and must easy to caculate the distance between 2 bounding boxes, thx! 