00001 00002 00003 /**************************************************************************** 00004 * VCGLib o o * 00005 * Visual and Computer Graphics Library o o * 00006 * _ O _ * 00007 * Copyright(C) 2004 \/)\/ * 00008 * Visual Computing Lab /\/| * 00009 * ISTI - Italian National Research Council | * 00010 * \ * 00011 * All rights reserved. * 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 00022 * for more details. * 00023 * * 00024 ****************************************************************************/ 00025 /**************************************************************************** 00026 History 00027 00028 $Log: not supported by cvs2svn $ 00029 Revision 1.1 2006/12/03 14:55:44 ganovelli 00030 created 00031 00032 00033 ****************************************************************************/ 00034 00035 00036 #ifndef __VCGLIB_TETRASUBSET 00037 #define __VCGLIB_TETRASUBSET 00038 00039 #include <vector> 00040 namespace vcg { 00041 namespace tetra { 00042 00045 00047 template <class TetraPtrContainer> 00048 void Component(TetraPtrContainer & src, TetraPtrContainer & conn_com){ 00049 00050 typename TetraPtrContainer::iterator ti; 00051 typedef typename TetraPtrContainer::value_type TetraPointer; 00052 00053 for(ti = src.begin(); ti != src.end(); ++ti) 00054 (*ti)->SetS(); 00055 00056 while(!src.empty()){ 00057 TetraPointer tp = src.back(); 00058 src.pop_back(); 00059 conn_com.push_back(tp); 00060 for(unsigned int i = 0; i < 4; ++i) 00061 if(!tp->TTp(i)->IsD()) 00062 if(!tp->TTp(i)->IsS()){ 00063 tp->TTp(i)->SetS(); 00064 src.push_back(tp->TTp(i)); 00065 } 00066 } 00067 for(ti = conn_com.begin(); ti != conn_com.end(); ++ti) 00068 (*ti)->ClearS(); 00069 } 00070 00072 } // End namespace 00073 } // End namespace 00074 00075 00076 #endif 00077