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 History 00025 00026 $Log: not supported by cvs2svn $ 00027 Revision 1.1 2005/07/06 08:02:27 cignoni 00028 Initial commit 00029 00030 00031 ****************************************************************************/ 00032 #ifndef __VCG_TRI_UPDATE_POSITION 00033 #define __VCG_TRI_UPDATE_POSITION 00034 00035 #include "normal.h" 00036 00037 namespace vcg { 00038 namespace tri { 00039 00041 00043 00045 template <class ComputeMeshType> 00046 class UpdatePosition 00047 { 00048 00049 public: 00050 typedef ComputeMeshType MeshType; 00051 typedef typename MeshType::ScalarType ScalarType; 00052 typedef typename MeshType::VertexType VertexType; 00053 typedef typename MeshType::VertexPointer VertexPointer; 00054 typedef typename MeshType::VertexIterator VertexIterator; 00055 typedef typename MeshType::FaceType FaceType; 00056 typedef typename MeshType::FacePointer FacePointer; 00057 typedef typename MeshType::FaceIterator FaceIterator; 00058 00060 static void Matrix(ComputeMeshType &m, const Matrix44<ScalarType> &M, bool update_also_normals = true) 00061 { 00062 VertexIterator vi; 00063 for(vi=m.vert.begin();vi!=m.vert.end();++vi) 00064 if(!(*vi).IsD()) (*vi).P()=M*(*vi).cP(); 00065 00066 if(update_also_normals){ 00067 if(m.HasPerVertexNormal()){ 00068 UpdateNormals<ComputeMeshType>::PerVertexMatrix(m,M); 00069 } 00070 if(m.HasPerFaceNormal()){ 00071 UpdateNormals<ComputeMeshType>::PerFaceMatrix(m,M); 00072 } 00073 } 00074 } 00075 00076 00077 }; // end class 00078 00079 } // End namespace 00080 } // End namespace 00081 00082 00083 #endif