00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00036
00037
00038
00039
00040
00041
00042 #ifndef OPENMESH_DECIMATER_COLLAPSEINFOT_HH
00043 #define OPENMESH_DECIMATER_COLLAPSEINFOT_HH
00044
00045
00046
00047
00048 #include <vector>
00049
00050
00051
00052
00053 namespace OpenMesh {
00054 namespace Decimater {
00055
00056
00057
00058
00067 template <class Mesh>
00068 struct CollapseInfoT
00069 {
00070 public:
00080 CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh);
00081
00082 Mesh& mesh;
00083
00084 typename Mesh::HalfedgeHandle v0v1;
00085 typename Mesh::HalfedgeHandle v1v0;
00086 typename Mesh::VertexHandle v0;
00087 typename Mesh::VertexHandle v1;
00088 typename Mesh::Point p0;
00089 typename Mesh::Point p1;
00090 typename Mesh::FaceHandle fl;
00091 typename Mesh::FaceHandle fr;
00092 typename Mesh::VertexHandle vl;
00093 typename Mesh::VertexHandle vr;
00094
00095
00098 typename Mesh::HalfedgeHandle vlv1, v0vl, vrv0, v1vr;
00100
00101 std::vector<typename Mesh::VertexHandle> one_ring;
00102 };
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 template <class Mesh>
00129 inline
00130 CollapseInfoT<Mesh>::
00131 CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh) :
00132
00133 mesh(_mesh),
00134 v0v1(_heh),
00135 v1v0(_mesh.opposite_halfedge_handle(v0v1)),
00136 v0(_mesh.to_vertex_handle(v1v0)),
00137 v1(_mesh.to_vertex_handle(v0v1)),
00138 p0(_mesh.point(v0)),
00139 p1(_mesh.point(v1)),
00140 fl(_mesh.face_handle(v0v1)),
00141 fr(_mesh.face_handle(v1v0))
00142
00143 {
00144
00145 if (fl.is_valid())
00146 {
00147 vlv1 = mesh.next_halfedge_handle(v0v1);
00148 v0vl = mesh.next_halfedge_handle(vlv1);
00149 vl = mesh.to_vertex_handle(vlv1);
00150 vlv1 = mesh.opposite_halfedge_handle(vlv1);
00151 v0vl = mesh.opposite_halfedge_handle(v0vl);
00152 }
00153
00154
00155
00156 if (fr.is_valid())
00157 {
00158 vrv0 = mesh.next_halfedge_handle(v1v0);
00159 v1vr = mesh.next_halfedge_handle(vrv0);
00160 vr = mesh.to_vertex_handle(vrv0);
00161 vrv0 = mesh.opposite_halfedge_handle(vrv0);
00162 v1vr = mesh.opposite_halfedge_handle(v1vr);
00163 }
00164
00165
00166
00167 one_ring.clear();
00168 for (typename Mesh::VVIter vv_it=mesh.vv_iter(v0); vv_it; ++vv_it)
00169 one_ring.push_back(vv_it);
00170 }
00171
00172
00173 }
00174 }
00175
00176 #endif // OPENMESH_DECIMATER_COLLAPSEINFOT_HH defined
00177
00178