obox3.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 * VCGLib                                                            o o     *
00003 * Visual and Computer Graphics Library                            o     o   *
00004 *                                                                _   O  _   *
00005 * Copyright(C) 2004                                                \/)\/    *
00006 * Visual Computing Lab                                            /\/|      *
00007 * ISTI - Italian National Research Council                           |      *
00008 *                                                                    \      *
00009 * All rights reserved.                                                      *
00010 *                                                                           *
00011 * This program is free software; you can redistribute it and/or modify      *   
00012 * it under the terms of the GNU General Public License as published by      *
00013 * the Free Software Foundation; either version 2 of the License, or         *
00014 * (at your option) any later version.                                       *
00015 *                                                                           *
00016 * This program is distributed in the hope that it will be useful,           *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020 * for more details.                                                         *
00021 *                                                                           *
00022 ****************************************************************************/
00023 
00024 #ifndef __VCGLIB_OBOX3
00025 #define __VCGLIB_OBOX3
00026 
00027 #include <vcg/space/box3.h>
00028 
00029 namespace vcg {
00030 
00031         template<class T>
00032         class Obox3:public Box3<T>{
00033 
00034         public:
00035                 
00036                 Matrix44<T> m;                  // a matrix to go in OB space
00037                 Matrix44<T> mi;           // inverse of m: from OB space to World
00038 
00040                 inline  Obox3():Box3<T>(){}
00042                 inline  Obox3(const Obox3 &b):Box3<T>(b.min,b.max),m(b.m),mi(b.mi){}
00044                 inline Obox3(const Point3<T> &min, const Point3<T> &max, const Point3<T> *frame):Box3<T>(min,max){
00045                         T v[16];
00046                         //BaseX:                                         BaseY:                                                  BaseZ:                                                         O:
00047                         v[0]=frame[0].X(); v[1] =frame[1].X(); v[2] =frame[2].X();  v[3] =frame[3].X();                 
00048                         v[4]=frame[0].Y(); v[5] =frame[1].Y(); v[6] =frame[2].Y();  v[7] =frame[3].Y(); 
00049                         v[8]=frame[0].Z(); v[9] =frame[1].Z(); v[10]=frame[2].Z();  v[11]=frame[3].Z();
00050                         v[12]=0.0;                               v[13]=0.0;                                      v[14]=0.0;                                             v[15]=1;                        
00051 
00052                         mi=Matrix44f(v);
00053                         m =Inverse(mi);
00054                 }
00055                 //Verifica se un punto appartiene ad un oriented bounding box.
00056                 bool IsIn( Point3<T> const &p) const{
00057                         vcg::Point3<T> mod= m*p;
00058                         return Box3<T>::IsIn(mod);
00059                 }
00061                 inline ~Obox3(){}
00062 
00063 
00064         }; // end class definition
00065         typedef Obox3<short>  Obox3s;
00066         typedef Obox3<int>        Obox3i;
00067         typedef Obox3<float>  Obox3f;
00068         typedef Obox3<double> Obox3d;
00069 
00070 } // end namespace
00071 
00072 
00073 #endif


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:33:32