00001 /**************************************************************************** 00002 * VCGLib o o * 00003 * Visual and Computer Graphics Library o o * 00004 * _ O _ * 00005 * Copyright(C) 2006 \/)\/ * 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 __VCG_FACE_PLUS_COMPONENT_RT 00025 #define __VCG_FACE_PLUS_COMPONENT_RT 00026 00027 #include <vcg/space/plane3.h> 00028 00029 namespace vcg { 00030 namespace face { 00031 00032 template <class CoordType> 00033 struct EdgePlaneInfo{ 00034 CoordType edge[3]; 00035 ::vcg::Plane3<typename CoordType::ScalarType> plane; 00036 typename CoordType::ScalarType edgescale; 00037 }; 00048 template <class T> class EdgePlane: public T { 00049 public: 00050 typedef EdgePlaneInfo<typename T::VertexType::CoordType> EdgePlaneType; 00051 00052 typename T::VertexType::CoordType &Edge(const int j) { 00053 return _ep.edge[j]; 00054 } 00055 typename T::VertexType::CoordType cEdge(const int j)const { 00056 return _ep.edge[j]; 00057 } 00058 00059 typename vcg::Plane3<typename T::VertexType::CoordType::ScalarType> &Plane() { 00060 return _ep.plane; 00061 } 00062 typename vcg::Plane3<typename T::VertexType::CoordType::ScalarType> cPlane()const { 00063 return _ep.plane; 00064 } 00065 00066 static bool HasEdgePlane() { return true; } 00067 00068 static void Name(std::vector<std::string> & name){name.push_back(std::string("EdgePlane"));T::Name(name);} 00069 00070 private: 00071 00072 EdgePlaneType _ep; 00073 }; 00074 00075 00076 // This empty class is rarely useful but you need it if you have code 00077 // where you eventually decide (not at compile time) what closest algorithm you need. 00078 // (for example in unit testing...) 00079 00080 template <class T> class EmptyEdgePlane: public T { 00081 public: 00082 typedef EdgePlaneInfo<typename T::VertexType::CoordType> EdgePlaneType; 00083 00084 typename T::VertexType::CoordType &Edge(const int ) { assert(0); static typename T::VertexType::CoordType dum; return dum;} 00085 typename T::VertexType::CoordType &cEdge(const int ) const { assert(0); static typename T::VertexType::CoordType dum; return dum;} 00086 00087 typename vcg::Plane3<typename T::VertexType::CoordType::ScalarType> &Plane() {assert(0); static typename vcg::Plane3<typename T::VertexType::CoordType::ScalarType> dum; return dum;} 00088 typename vcg::Plane3<typename T::VertexType::CoordType::ScalarType> &cPlane() const {assert(0); static typename vcg::Plane3<typename T::VertexType::CoordType::ScalarType> dum; return dum;} 00089 static bool HasEdgePlane() { return false; } 00090 00091 static void Name(std::vector<std::string> & name){name.push_back(std::string(""));T::Name(name);} 00092 }; 00097 } // end namespace face 00098 }// end namespace vcg 00099 #endif