OpenMesh
|
00001 /*===========================================================================*\ 00002 * * 00003 * OpenMesh * 00004 * Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen * 00005 * www.openmesh.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenMesh. * 00009 * * 00010 * OpenMesh is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenMesh is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenMesh. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 362 $ * 00038 * $Date: 2011-01-26 10:21:12 +0100 (Mi, 26 Jan 2011) $ * 00039 * * 00040 \*===========================================================================*/ 00041 00046 //============================================================================= 00047 // 00048 // CLASS Traits 00049 // 00050 //============================================================================= 00051 00052 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH 00053 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH 00054 00055 00056 //== INCLUDES ================================================================= 00057 00058 //#include "Config.hh" 00059 // -------------------- 00060 #include <OpenMesh/Core/Mesh/Traits.hh> 00061 #include <OpenMesh/Core/Mesh/Attributes.hh> 00062 00063 00064 //== NAMESPACE ================================================================ 00065 00066 namespace OpenMesh { // BEGIN_NS_OPENMESH 00067 namespace Subdivider { // BEGIN_NS_DECIMATER 00068 namespace Uniform { // BEGIN_NS_UNIFORM 00069 00070 00071 //== CLASS DEFINITION ========================================================= 00072 00073 00077 struct CompositeTraits : public OpenMesh::DefaultTraits 00078 { 00079 FaceAttributes( OpenMesh::Attributes::Normal ); 00080 00081 VertexAttributes( OpenMesh::Attributes::Normal ); 00082 00083 //HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge ); 00084 00085 FaceTraits 00086 { 00087 private: 00088 typedef typename Refs::HalfedgeHandle HalfedgeHandle; 00089 typedef typename Refs::Scalar Scalar; 00090 typedef typename Refs::Point Point; 00091 HalfedgeHandle red_halfedge_handle_; 00092 unsigned int generation_; 00093 bool red_; 00094 Scalar quality_; 00095 Point midpoint_; 00096 Point position_; 00097 00098 public: 00099 const unsigned int& generation() { return generation_; } 00100 void set_generation(const unsigned int& _g) { generation_ = _g; } 00101 void inc_generation() { ++generation_; } 00102 void set_red() { red_ = 1; } 00103 void set_green() {red_ = 0; } 00104 bool is_red() { return red_; } 00105 bool is_green() { return !red_; } 00106 void set_red_halfedge_handle(HalfedgeHandle& _heh) 00107 { red_halfedge_handle_ = _heh; } 00108 HalfedgeHandle& red_halfedge_handle() { return red_halfedge_handle_; } 00109 void set_quality(Scalar& _q) { quality_ = _q; } 00110 Scalar& quality() { return quality_; } 00111 const Point& midpoint() const { return midpoint_; } 00112 void set_midpoint(const Point& _p) { midpoint_ = _p; } 00113 const Point& position() const { return position_; } 00114 void set_position(const Point& _p) { position_ = _p; } 00115 }; 00116 00117 EdgeTraits 00118 { 00119 private: 00120 typedef typename Refs::Point Point; 00121 typedef typename Refs::Scalar Scalar; 00122 Point midpoint_; 00123 Scalar length_; 00124 Point position_; 00125 public: 00126 const Point& midpoint() const { return midpoint_; } 00127 void set_midpoint(const Point& _vh) { midpoint_ = _vh; } 00128 const Scalar& length() const { return length_; } 00129 void set_length(const Scalar& _s) { length_ = _s; } 00130 const Point& position() const { return position_; } 00131 void set_position(const Point& _p) { position_ = _p; } 00132 }; 00133 00134 VertexTraits 00135 { 00136 private: 00137 typedef typename Refs::Point Point; 00138 Point new_pos_; 00139 Point orig_pos_; 00140 Point position_; 00141 unsigned int generation_; 00142 public: 00143 const Point& new_pos() const { return new_pos_; } 00144 void set_new_pos(const Point& _p) { new_pos_ = _p; } 00145 const unsigned int& generation() const { return generation_; } 00146 void set_generation(const unsigned int& _i) { generation_ = _i; } 00147 const Point& orig_pos() const { return orig_pos_; } 00148 void set_orig_pos(const Point& _p) { orig_pos_ = _p; } 00149 const Point& position() const { return position_; } 00150 void set_position(const Point& _p) { position_ = _p; } 00151 }; 00152 }; 00153 00154 //============================================================================= 00155 } // END_NS_UNIFORM 00156 } // END_NS_SUBDIVIDER 00157 } // END_NS_OPENMESH 00158 //============================================================================= 00159 #endif // OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH defined 00160 //============================================================================= 00161