Developer Documentation
CompositeTraits.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 
48 //=============================================================================
49 //
50 // CLASS Traits
51 //
52 //=============================================================================
53 
54 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
55 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
56 
57 
58 //== INCLUDES =================================================================
59 
60 //#include "Config.hh"
61 // --------------------
64 
65 
66 //== NAMESPACE ================================================================
67 
68 namespace OpenMesh { // BEGIN_NS_OPENMESH
69 namespace Subdivider { // BEGIN_NS_DECIMATER
70 namespace Uniform { // BEGIN_NS_UNIFORM
71 
72 
73 //== CLASS DEFINITION =========================================================
74 
75 
80 {
81  FaceAttributes( OpenMesh::Attributes::Normal );
82 
83  VertexAttributes( OpenMesh::Attributes::Normal );
84 
85  //HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge );
86 
87  FaceTraits
88  {
89 
90  private:
91  typedef typename Refs::HalfedgeHandle HalfedgeHandle;
92  typedef typename Refs::Scalar Scalar;
93  typedef typename Refs::Point Point;
94  HalfedgeHandle red_halfedge_handle_;
95  unsigned int generation_;
96  bool red_;
97  Scalar quality_;
98  Point midpoint_;
99  Point position_;
100 
101  public:
102  const unsigned int& generation() { return generation_; }
103  void set_generation(const unsigned int& _g) { generation_ = _g; }
104  void inc_generation() { ++generation_; }
105  void set_red() { red_ = 1; }
106  void set_green() {red_ = 0; }
107  bool is_red() { return red_; }
108  bool is_green() { return !red_; }
109  void set_red_halfedge_handle(HalfedgeHandle& _heh)
110  { red_halfedge_handle_ = _heh; }
111  HalfedgeHandle& red_halfedge_handle() { return red_halfedge_handle_; }
112  void set_quality(Scalar& _q) { quality_ = _q; }
113  Scalar& quality() { return quality_; }
114  const Point& midpoint() const { return midpoint_; }
115  void set_midpoint(const Point& _p) { midpoint_ = _p; }
116  const Point& position() const { return position_; }
117  void set_position(const Point& _p) { position_ = _p; }
118  };
119 
120  EdgeTraits
121  {
122  private:
123  typedef typename Refs::Point Point;
124  typedef typename Refs::Scalar Scalar;
125  Point midpoint_;
126  Scalar length_;
127  Point position_;
128  public:
129  const Point& midpoint() const { return midpoint_; }
130  void set_midpoint(const Point& _vh) { midpoint_ = _vh; }
131  const Scalar& length() const { return length_; }
132  void set_length(const Scalar& _s) { length_ = _s; }
133  const Point& position() const { return position_; }
134  void set_position(const Point& _p) { position_ = _p; }
135  };
136 
137  VertexTraits
138  {
139  private:
140  typedef typename Refs::Point Point;
141  Point new_pos_;
142  Point orig_pos_;
143  Point position_;
144  unsigned int generation_;
145  public:
146  const Point& new_pos() const { return new_pos_; }
147  void set_new_pos(const Point& _p) { new_pos_ = _p; }
148  const unsigned int& generation() const { return generation_; }
149  void set_generation(const unsigned int& _i) { generation_ = _i; }
150  const Point& orig_pos() const { return orig_pos_; }
151  void set_orig_pos(const Point& _p) { orig_pos_ = _p; }
152  const Point& position() const { return position_; }
153  void set_position(const Point& _p) { position_ = _p; }
154  };
155 };
156 
157 //=============================================================================
158 } // END_NS_UNIFORM
159 } // END_NS_SUBDIVIDER
160 } // END_NS_OPENMESH
161 //=============================================================================
162 #endif // OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH defined
163 //=============================================================================
164 
Handle for a halfedge entity.
Definition: Handles.hh:127
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:82