OpenMesh
CollapseInfoT.hh
Go to the documentation of this file.
1 /* ========================================================================= *
2  * *
3  * OpenMesh *
4  * Copyright (c) 2001-2022, 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:
76  CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh);
77 
78  Mesh& mesh;
79 
80  typename Mesh::HalfedgeHandle v0v1;
81  typename Mesh::HalfedgeHandle v1v0;
84  typename Mesh::Point p0;
85  typename Mesh::Point p1;
86  typename Mesh::FaceHandle fl;
87  typename Mesh::FaceHandle fr;
91 
94  typename Mesh::HalfedgeHandle vlv1, v0vl, vrv0, v1vr;
96 };
97 
98 //-----------------------------------------------------------------------------
99 
126 template<class Mesh>
128  typename Mesh::HalfedgeHandle _heh) :
129  mesh(_mesh), v0v1(_heh), v1v0(_mesh.opposite_halfedge_handle(v0v1)), v0(
130  _mesh.to_vertex_handle(v1v0)), v1(_mesh.to_vertex_handle(v0v1)), p0(
131  _mesh.point(v0)), p1(_mesh.point(v1)), fl(_mesh.face_handle(v0v1)), fr(
132  _mesh.face_handle(v1v0))
133 
134 {
135  // get vl
136  if (fl.is_valid()) {
137  vlv1 = mesh.next_halfedge_handle(v0v1);
138  v0vl = mesh.next_halfedge_handle(vlv1);
139  vl = mesh.to_vertex_handle(vlv1);
140  vlv1 = mesh.opposite_halfedge_handle(vlv1);
141  v0vl = mesh.opposite_halfedge_handle(v0vl);
142  }
143 
144  // get vr
145  if (fr.is_valid()) {
146  vrv0 = mesh.next_halfedge_handle(v1v0);
147  v1vr = mesh.next_halfedge_handle(vrv0);
148  vr = mesh.to_vertex_handle(vrv0);
149  vrv0 = mesh.opposite_halfedge_handle(vrv0);
150  v1vr = mesh.opposite_halfedge_handle(v1vr);
151  }
152 }
153 
154 //=============================================================================
155 }// END_NS_DECIMATER
156 } // END_NS_OPENMESH
157 //=============================================================================
158 #endif // OPENMESH_DECIMATER_COLLAPSEINFOT_HH defined
159 //=============================================================================
160 
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
Kernel::FaceHandle FaceHandle
Scalar type.
Definition: PolyMeshT.hh:139
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:74
Mesh::HalfedgeHandle vlv1
Outer remaining halfedge of diamond spanned by v0, v1, vl, and vr.
Definition: CollapseInfoT.hh:94
Mesh::FaceHandle fr
Right face.
Definition: CollapseInfoT.hh:87
CollapseInfoT(Mesh &_mesh, typename Mesh::HalfedgeHandle _heh)
Initializing constructor.
Definition: CollapseInfoT.hh:127
Mesh::VertexHandle vl
Left vertex.
Definition: CollapseInfoT.hh:88
Mesh::Point p0
Position of removed vertex.
Definition: CollapseInfoT.hh:84
Mesh::HalfedgeHandle v0v1
Halfedge to be collapsed.
Definition: CollapseInfoT.hh:80
Mesh::HalfedgeHandle v1v0
Reverse halfedge.
Definition: CollapseInfoT.hh:81
Mesh::VertexHandle v1
Remaining vertex.
Definition: CollapseInfoT.hh:83
Mesh::Point p1
Positions of remaining vertex.
Definition: CollapseInfoT.hh:85
Mesh::VertexHandle v0
Vertex to be removed.
Definition: CollapseInfoT.hh:82
Mesh::FaceHandle fl
Left face.
Definition: CollapseInfoT.hh:86
Mesh::VertexHandle vr
Right vertex.
Definition: CollapseInfoT.hh:89

Project OpenMesh, ©  Visual Computing Institute, RWTH Aachen. Documentation generated using doxygen .