Developer Documentation
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 
48 //=============================================================================
49 //
50 // STRUCT CollpaseInfoT
51 //
52 //=============================================================================
53 #ifndef OPENMESH_DECIMATER_COLLAPSEINFOT_HH
54 #define OPENMESH_DECIMATER_COLLAPSEINFOT_HH
55 
56 //== INCLUDES =================================================================
57 
58 //== NAMESPACE ================================================================
59 
60 namespace OpenMesh {
61 namespace Decimater {
62 
63 //== CLASS DEFINITION =========================================================
64 
73 template<class Mesh>
74 struct CollapseInfoT {
75  public:
85  CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh);
86 
87  Mesh& mesh;
88 
89  typename Mesh::HalfedgeHandle v0v1;
90  typename Mesh::HalfedgeHandle v1v0;
93  typename Mesh::Point p0;
94  typename Mesh::Point p1;
95  typename Mesh::FaceHandle fl;
96  typename Mesh::FaceHandle fr;
99 
100 
103  typename Mesh::HalfedgeHandle vlv1, v0vl, vrv0, v1vr;
105 };
106 
107 //-----------------------------------------------------------------------------
108 
128 template<class Mesh>
130  typename Mesh::HalfedgeHandle _heh) :
131  mesh(_mesh), v0v1(_heh), v1v0(_mesh.opposite_halfedge_handle(v0v1)), v0(
132  _mesh.to_vertex_handle(v1v0)), v1(_mesh.to_vertex_handle(v0v1)), p0(
133  _mesh.point(v0)), p1(_mesh.point(v1)), fl(_mesh.face_handle(v0v1)), fr(
134  _mesh.face_handle(v1v0))
135 
136 {
137  // get vl
138  if (fl.is_valid()) {
139  vlv1 = mesh.next_halfedge_handle(v0v1);
140  v0vl = mesh.next_halfedge_handle(vlv1);
141  vl = mesh.to_vertex_handle(vlv1);
142  vlv1 = mesh.opposite_halfedge_handle(vlv1);
143  v0vl = mesh.opposite_halfedge_handle(v0vl);
144  }
145 
146  // get vr
147  if (fr.is_valid()) {
148  vrv0 = mesh.next_halfedge_handle(v1v0);
149  v1vr = mesh.next_halfedge_handle(vrv0);
150  vr = mesh.to_vertex_handle(vrv0);
151  vrv0 = mesh.opposite_halfedge_handle(vrv0);
152  v1vr = mesh.opposite_halfedge_handle(v1vr);
153  }
154 }
155 
156 //=============================================================================
157 }// END_NS_DECIMATER
158 } // END_NS_OPENMESH
159 //=============================================================================
160 #endif // OPENMESH_DECIMATER_COLLAPSEINFOT_HH defined
161 //=============================================================================
162 
Mesh::VertexHandle vr
Right vertex.
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
Mesh::FaceHandle fl
Left face.
Mesh::VertexHandle vl
Left vertex.
Mesh::FaceHandle fr
Right face.
Mesh::HalfedgeHandle v0v1
Halfedge to be collapsed.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
Mesh::VertexHandle v0
Vertex to be removed.
CollapseInfoT(Mesh &_mesh, typename Mesh::HalfedgeHandle _heh)
Mesh::Point p1
Positions of remaining vertex.
Mesh::HalfedgeHandle v1v0
Reverse halfedge.
Mesh::Point p0
Position of removed vertex.
Mesh::VertexHandle v1
Remaining vertex.