/**************************************************************************** * VCGLib o o * * Visual and Computer Graphics Library o o * * _ O _ * * Copyright(C) 2004 \/)\/ * * Visual Computing Lab /\/| * * ISTI - Italian National Research Council | * * \ * * All rights reserved. * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * for more details. * * * ****************************************************************************/ #ifndef __VCGLIB_OBOX3 #define __VCGLIB_OBOX3 #include namespace vcg { template class Obox3:public Box3{ public: Matrix44 m; // a matrix to go in OB space Matrix44 mi; // inverse of m: from OB space to World /// The bounding box constructor inline Obox3():Box3(){} /// Copy constructor inline Obox3(const Obox3 &b):min(b.min),max(b.max),m(b.m),mi(b.mi){} /// Min Max Frame constructor inline Obox3(const Point3 &min, const Point3 &max, const Point3 *frame):Box3(min,max){ T v[16]; //BaseX: BaseY: BaseZ: O: v[0]=frame[0].X(); v[1] =frame[1].X(); v[2] =frame[2].X(); v[3] =frame[3].X(); v[4]=frame[0].Y(); v[5] =frame[1].Y(); v[6] =frame[2].Y(); v[7] =frame[3].Y(); v[8]=frame[0].Z(); v[9] =frame[1].Z(); v[10]=frame[2].Z(); v[11]=frame[3].Z(); v[12]=0.0; v[13]=0.0; v[14]=0.0; v[15]=1; mi=Matrix44f(v); m =Inverse(mi); } //Verifica se un punto appartiene ad un oriented bounding box. bool IsIn( Point3 const &p) const{ vcg::Point3 mod= m*p; return Box3::IsIn(mod); } /// The bounding box distructor inline ~Obox3(){} }; // end class definition typedef Obox3 Obox3s; typedef Obox3 Obox3i; typedef Obox3 Obox3f; typedef Obox3 Obox3d; } // end namespace #endif