Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DecimaterInfo.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
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 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 #include "DecimaterInfo.hh"
51 
52 DecimaterInfo::DecimaterInfo() :
53  normalDeviation_(false),
54  normalFlipping_(false),
55  distance_(false),
56  edgeLength_(false),
57  aspectRatio_(false),
58  roundness_(false),
59  independentSets_(false),
60  decimationOrder_(DISTANCE),
61  normalDeviation_value_(0),
62  distance_value_(0),
63  edgeLength_value_(0),
64  aspectRatio_value_(0),
65  roundness_value_(0) {}
66 
67 
68 DecimaterInfo::~DecimaterInfo() {
69 }
70 
72 
73  DecimaterInfo* di_copy = new DecimaterInfo(*this);
74 
75  return di_copy;
76 }
77 
78 //-----------------------------------------------------------------------------------
79 
80 void DecimaterInfo::setDistanceConstraint( double _value ){
81 
82  distance_ = true;
83  distance_value_ = _value;
84 }
85 
86 
87 //-----------------------------------------------------------------------------------
88 
89 void DecimaterInfo::setNormalDeviationConstraint( int _value ){
90 
91  normalDeviation_ = true;
92  normalDeviation_value_ = _value;
93 }
94 
95 
96 //-----------------------------------------------------------------------------------
97 
98 void DecimaterInfo::setNormalFlippingConstraint(){
99 
100  normalFlipping_ = true;
101 }
102 
103 
104 //-----------------------------------------------------------------------------------
105 
106 void DecimaterInfo::setIndependentSetsConstraint(){
107 
108  independentSets_ = true;
109 }
110 
111 
112 //-----------------------------------------------------------------------------------
113 
114 void DecimaterInfo::setRoundnessConstraint( double _value ){
115 
116  roundness_ = true;
117  roundness_value_ = _value;
118 }
119 
120 //-----------------------------------------------------------------------------------
121 
122 void DecimaterInfo::setAspectRatioConstraint( double _value ){
123 
124  aspectRatio_ = true;
125  aspectRatio_value_ = _value;
126 }
127 
128 //-----------------------------------------------------------------------------------
129 
130 void DecimaterInfo::setEdgeLengthConstraint( double _value ){
131 
132  edgeLength_ = true;
133  edgeLength_value_ = _value;
134 }
135 
136 //-----------------------------------------------------------------------------------
137 
138 void DecimaterInfo::setDecimationOrder( DecimationOrder _order ){
139 
140  decimationOrder_ = _order;
141 }
142 
143 //-----------------------------------------------------------------------------------
144 
145 void DecimaterInfo::removeDistanceConstraint(){
146 
147  if ( distance_ ) {
148  distance_ = false;
149  distance_value_ = 0;
150  }
151 }
152 
153 
154 //-----------------------------------------------------------------------------------
155 
156 void DecimaterInfo::removeEdgeLengthConstraint(){
157 
158  if ( edgeLength_ ) {
159  edgeLength_ = false;
160  edgeLength_value_ = 0;
161  }
162 }
163 
164 
165 //-----------------------------------------------------------------------------------
166 
167 void DecimaterInfo::removeNormalDeviationConstraint(){
168 
169  if ( normalDeviation_ ) {
170  normalDeviation_ = false;
171  normalDeviation_value_ = 0;
172  }
173 }
174 
175 
176 //-----------------------------------------------------------------------------------
177 
178 void DecimaterInfo::removeNormalFlippingConstraint(){
179 
180  if ( normalFlipping_ ) {
181  normalFlipping_ = false;
182  }
183 }
184 
185 
186 //-----------------------------------------------------------------------------------
187 
188 void DecimaterInfo::removeIndependentSetsConstraint(){
189 
190  if ( independentSets_ ) {
191  independentSets_ = false;
192  }
193 }
194 
195 
196 //-----------------------------------------------------------------------------------
197 
198 void DecimaterInfo::removeAspectRatioConstraint(){
199 
200  if ( aspectRatio_ ) {
201  aspectRatio_ = false;
202  aspectRatio_value_ = 0;
203  }
204 }
205 
206 
207 //-----------------------------------------------------------------------------------
208 
209 void DecimaterInfo::removeRoundnessConstraint(){
210 
211  if ( roundness_ ) {
212  roundness_ = false;
213  roundness_value_ = 0;
214  }
215 }
216 
217 
PerObjectData * copyPerObjectData()
Copy Function.
Object Payload.