OpenMesh: OpenMesh/Tools/Decimater/CollapseInfoT.hh Source File

| OpenMesh

CollapseInfoT.hh
Go to the documentation of this file.
1 /* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $Date$ *
46 * *
47 \*===========================================================================*/
48
54 //=============================================================================
55 //
56 // STRUCT CollpaseInfoT
57 //
58 //=============================================================================
59 #ifndef OPENMESH_DECIMATER_COLLAPSEINFOT_HH
60 #define OPENMESH_DECIMATER_COLLAPSEINFOT_HH
61
62 //== INCLUDES =================================================================
63
64 //== NAMESPACE ================================================================
65
66 namespace OpenMesh {
67 namespace Decimater {
68
69 //== CLASS DEFINITION =========================================================
70
79 template<class Mesh>
80 struct CollapseInfoT {
81 public:
91 CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh);
92
93 Mesh& mesh;
94
95 typename Mesh::HalfedgeHandle v0v1;
96 typename Mesh::HalfedgeHandle v1v0;
97 typename Mesh::VertexHandle v0;
98 typename Mesh::VertexHandle v1;
99 typename Mesh::Point p0;
100 typename Mesh::Point p1;
101 typename Mesh::FaceHandle fl;
102 typename Mesh::FaceHandle fr;
103 typename Mesh::VertexHandle vl;
104 typename Mesh::VertexHandle vr;
105
106
109 typename Mesh::HalfedgeHandle vlv1, v0vl, vrv0, v1vr;
111 };
112
113 //-----------------------------------------------------------------------------
114
134 template<class Mesh>
135 inline CollapseInfoT<Mesh>::CollapseInfoT(Mesh& _mesh,
136 typename Mesh::HalfedgeHandle _heh) :
137 mesh(_mesh), v0v1(_heh), v1v0(_mesh.opposite_halfedge_handle(v0v1)), v0(
138 _mesh.to_vertex_handle(v1v0)), v1(_mesh.to_vertex_handle(v0v1)), p0(
139 _mesh.point(v0)), p1(_mesh.point(v1)), fl(_mesh.face_handle(v0v1)), fr(
140 _mesh.face_handle(v1v0))
141
142 {
143 // get vl
144 if (fl.is_valid()) {
145 vlv1 = mesh.next_halfedge_handle(v0v1);
146 v0vl = mesh.next_halfedge_handle(vlv1);
147 vl = mesh.to_vertex_handle(vlv1);
148 vlv1 = mesh.opposite_halfedge_handle(vlv1);
149 v0vl = mesh.opposite_halfedge_handle(v0vl);
150 }
151
152 // get vr
153 if (fr.is_valid()) {
154 vrv0 = mesh.next_halfedge_handle(v1v0);
155 v1vr = mesh.next_halfedge_handle(vrv0);
156 vr = mesh.to_vertex_handle(vrv0);
157 vrv0 = mesh.opposite_halfedge_handle(vrv0);
158 v1vr = mesh.opposite_halfedge_handle(v1vr);
159 }
160 }
161
162 //=============================================================================
163 }// END_NS_DECIMATER
164 } // END_NS_OPENMESH
165 //=============================================================================
166 #endif // OPENMESH_DECIMATER_COLLAPSEINFOT_HH defined
167 //=============================================================================
168
OpenMesh::Decimater::CollapseInfoT::fr
Mesh::FaceHandle fr
Right face.
Definition: CollapseInfoT.hh:102
OpenMesh::Decimater::CollapseInfoT::vrv0
Mesh::HalfedgeHandle vrv0
Outer remaining halfedge of diamond spanned by v0, v1, vl, and vr.
Definition: CollapseInfoT.hh:109
OpenMesh::Decimater::CollapseInfoT::v0vl
Mesh::HalfedgeHandle v0vl
Outer remaining halfedge of diamond spanned by v0, v1, vl, and vr.
Definition: CollapseInfoT.hh:109
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
OpenMesh::Decimater::CollapseInfoT::v0v1
Mesh::HalfedgeHandle v0v1
Halfedge to be collapsed.
Definition: CollapseInfoT.hh:95
OpenMesh::Decimater::CollapseInfoT::v0
Mesh::VertexHandle v0
Vertex to be removed.
Definition: CollapseInfoT.hh:97
OpenMesh::Decimater::CollapseInfoT::vr
Mesh::VertexHandle vr
Right vertex.
Definition: CollapseInfoT.hh:104
OpenMesh::Decimater::CollapseInfoT::CollapseInfoT
CollapseInfoT(Mesh &_mesh, typename Mesh::HalfedgeHandle _heh)
Initializing constructor.
Definition: CollapseInfoT.hh:135
OpenMesh::Decimater::CollapseInfoT::vlv1
Mesh::HalfedgeHandle vlv1
Outer remaining halfedge of diamond spanned by v0, v1, vl, and vr.
Definition: CollapseInfoT.hh:109
OpenMesh::Decimater::CollapseInfoT
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:80
OpenMesh::Decimater::CollapseInfoT::fl
Mesh::FaceHandle fl
Left face.
Definition: CollapseInfoT.hh:101
OpenMesh::Decimater::CollapseInfoT::v1v0
Mesh::HalfedgeHandle v1v0
Reverse halfedge.
Definition: CollapseInfoT.hh:96
OpenMesh::Decimater::CollapseInfoT::v1vr
Mesh::HalfedgeHandle v1vr
Outer remaining halfedge of diamond spanned by v0, v1, vl, and vr.
Definition: CollapseInfoT.hh:109
OpenMesh::Decimater::CollapseInfoT::v1
Mesh::VertexHandle v1
Remaining vertex.
Definition: CollapseInfoT.hh:98
OpenMesh::Decimater::CollapseInfoT::p0
Mesh::Point p0
Position of removed vertex.
Definition: CollapseInfoT.hh:99
OpenMesh::Decimater::CollapseInfoT::p1
Mesh::Point p1
Positions of remaining vertex.
Definition: CollapseInfoT.hh:100
OpenMesh::Decimater::CollapseInfoT::vl
Mesh::VertexHandle vl
Left vertex.
Definition: CollapseInfoT.hh:103