Main Page | File List

BBox.cpp

Go to the documentation of this file.
00001 /**
00002  *\file         BBox.cpp
00003  *
00004  *\brief        
00005  *
00006  *\author       Xianming Chen\n
00007  *              Computer Science Department\n
00008  *              University of Utah
00009  *
00010  *\date         12 Jul 2004\n
00011  *              Copyright (c) 2004, University of Utah
00012  */
00013 
00014 
00015 #include "BBox.h"
00016 #include "TriangleMesh.h"
00017 
00018 
00019 namespace columbia
00020 {
00021   BBox :: BBox(TriangleMesh const& msh)
00022   {
00023     float minx, miny, minz, maxx, maxy, maxz;
00024     minx = maxx = msh.V[1].x;
00025     miny = maxy = msh.V[1].y;
00026     minz = maxz = msh.V[1].z;
00027     
00028     for(int v = 2; v < msh.V.size(); v++)
00029     {
00030       float x = msh.V[v].x;
00031       float y = msh.V[v].y;
00032       float z = msh.V[v].z;
00033 
00034       if(x < minx) minx = x;
00035       else if(x > maxx) maxx = x;
00036 
00037       if(y < miny) miny = y;
00038       else if(y > maxy) maxy = y;
00039 
00040       if(z < minz) minz = z;
00041       else if(z > maxz) maxz = z;
00042     }
00043     min = Point(minx, miny, minz);
00044     max = Point(maxx, maxy, maxz);
00045     center = (min + max) / 2;
00046   }
00047   
00048 
00049 
00050 }//end namespace xchen

Generated on Wed Jul 14 19:41:55 2004 by doxygen 1.3.6