OpenMesh

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CompositeTraits.hh
Go to the documentation of this file.
1 /*===========================================================================*\
2 * *
3 * OpenMesh *
4 * Copyright (C) 2001-2012 by Computer Graphics Group, RWTH Aachen *
5 * www.openmesh.org *
6 * *
7 *---------------------------------------------------------------------------*
8 * This file is part of OpenMesh. *
9 * *
10 * OpenMesh is free software: you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License as *
12 * published by the Free Software Foundation, either version 3 of *
13 * the License, or (at your option) any later version with the *
14 * following exceptions: *
15 * *
16 * If other files instantiate templates or use macros *
17 * or inline functions from this file, or you compile this file and *
18 * link it with other files to produce an executable, this file does *
19 * not by itself cause the resulting executable to be covered by the *
20 * GNU Lesser General Public License. This exception does not however *
21 * invalidate any other reasons why the executable file might be *
22 * covered by the GNU Lesser General Public License. *
23 * *
24 * OpenMesh is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU Lesser General Public License for more details. *
28 * *
29 * You should have received a copy of the GNU LesserGeneral Public *
30 * License along with OpenMesh. If not, *
31 * see <http://www.gnu.org/licenses/>. *
32 * *
33 \*===========================================================================*/
34
35 /*===========================================================================*\
36 * *
37 * $Revision: 736 $ *
38 * $Date: 2012-10-08 09:30:49 +0200 (Mo, 08. Okt 2012) $ *
39 * *
40 \*===========================================================================*/
41
46 //=============================================================================
47 //
48 // CLASS Traits
49 //
50 //=============================================================================
51
52 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
53 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
54
55
56 //== INCLUDES =================================================================
57
58 //#include "Config.hh"
59 // --------------------
60 #include <OpenMesh/Core/Mesh/Traits.hh>
61 #include <OpenMesh/Core/Mesh/Attributes.hh>
62
63
64 //== NAMESPACE ================================================================
65
66 namespace OpenMesh { // BEGIN_NS_OPENMESH
67 namespace Subdivider { // BEGIN_NS_DECIMATER
68 namespace Uniform { // BEGIN_NS_UNIFORM
69
70
71 //== CLASS DEFINITION =========================================================
72
73
77 struct CompositeTraits : public OpenMesh::DefaultTraits
78 {
79 FaceAttributes( OpenMesh::Attributes::Normal );
80
81 VertexAttributes( OpenMesh::Attributes::Normal );
82
83 //HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge );
84
85 FaceTraits
86 {
87 private:
88 typedef typename Refs::HalfedgeHandle HalfedgeHandle;
89 typedef typename Refs::Scalar Scalar;
90 typedef typename Refs::Point Point;
91 HalfedgeHandle red_halfedge_handle_;
92 unsigned int generation_;
93 bool red_;
94 Scalar quality_;
95 Point midpoint_;
96 Point position_;
97
98 public:
99 const unsigned int& generation() { return generation_; }
100 void set_generation(const unsigned int& _g) { generation_ = _g; }
101 void inc_generation() { ++generation_; }
102 void set_red() { red_ = 1; }
103 void set_green() {red_ = 0; }
104 bool is_red() { return red_; }
105 bool is_green() { return !red_; }
106 void set_red_halfedge_handle(HalfedgeHandle& _heh)
107 { red_halfedge_handle_ = _heh; }
108 HalfedgeHandle& red_halfedge_handle() { return red_halfedge_handle_; }
109 void set_quality(Scalar& _q) { quality_ = _q; }
110 Scalar& quality() { return quality_; }
111 const Point& midpoint() const { return midpoint_; }
112 void set_midpoint(const Point& _p) { midpoint_ = _p; }
113 const Point& position() const { return position_; }
114 void set_position(const Point& _p) { position_ = _p; }
115 };
116
117 EdgeTraits
118 {
119 private:
120 typedef typename Refs::Point Point;
121 typedef typename Refs::Scalar Scalar;
122 Point midpoint_;
123 Scalar length_;
124 Point position_;
125 public:
126 const Point& midpoint() const { return midpoint_; }
127 void set_midpoint(const Point& _vh) { midpoint_ = _vh; }
128 const Scalar& length() const { return length_; }
129 void set_length(const Scalar& _s) { length_ = _s; }
130 const Point& position() const { return position_; }
131 void set_position(const Point& _p) { position_ = _p; }
132 };
133
134 VertexTraits
135 {
136 private:
137 typedef typename Refs::Point Point;
138 Point new_pos_;
139 Point orig_pos_;
140 Point position_;
141 unsigned int generation_;
142 public:
143 const Point& new_pos() const { return new_pos_; }
144 void set_new_pos(const Point& _p) { new_pos_ = _p; }
145 const unsigned int& generation() const { return generation_; }
146 void set_generation(const unsigned int& _i) { generation_ = _i; }
147 const Point& orig_pos() const { return orig_pos_; }
148 void set_orig_pos(const Point& _p) { orig_pos_ = _p; }
149 const Point& position() const { return position_; }
150 void set_position(const Point& _p) { position_ = _p; }
151 };
152 };
153
154 //=============================================================================
155 } // END_NS_UNIFORM
156 } // END_NS_SUBDIVIDER
157 } // END_NS_OPENMESH
158 //=============================================================================
159 #endif // OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH defined
160 //=============================================================================
161