Developer Documentation

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 #include "DecimaterInfo.hh"
45
46 DecimaterInfo::DecimaterInfo() :
47 normalDeviation_(false),
48 normalFlipping_(false),
49 distance_(false),
50 edgeLength_(false),
51 aspectRatio_(false),
52 roundness_(false),
53 independentSets_(false),
54 decimationOrder_(DISTANCE),
55 normalDeviation_value_(0),
56 distance_value_(0),
57 edgeLength_value_(0),
58 aspectRatio_value_(0),
59 roundness_value_(0) {}
60
61
62 DecimaterInfo::~DecimaterInfo() {
63 }
64
65 PerObjectData* DecimaterInfo::copyPerObjectData() {
66
67 DecimaterInfo* di_copy = new DecimaterInfo(*this);
68
69 return di_copy;
70 }
71
72 //-----------------------------------------------------------------------------------
73
74 void DecimaterInfo::setDistanceConstraint( double _value ){
75
76 distance_ = true;
77 distance_value_ = _value;
78 }
79
80
81 //-----------------------------------------------------------------------------------
82
83 void DecimaterInfo::setNormalDeviationConstraint( int _value ){
84
85 normalDeviation_ = true;
86 normalDeviation_value_ = _value;
87 }
88
89
90 //-----------------------------------------------------------------------------------
91
92 void DecimaterInfo::setNormalFlippingConstraint(){
93
94 normalFlipping_ = true;
95 }
96
97
98 //-----------------------------------------------------------------------------------
99
100 void DecimaterInfo::setIndependentSetsConstraint(){
101
102 independentSets_ = true;
103 }
104
105
106 //-----------------------------------------------------------------------------------
107
108 void DecimaterInfo::setRoundnessConstraint( double _value ){
109
110 roundness_ = true;
111 roundness_value_ = _value;
112 }
113
114 //-----------------------------------------------------------------------------------
115
116 void DecimaterInfo::setAspectRatioConstraint( double _value ){
117
118 aspectRatio_ = true;
119 aspectRatio_value_ = _value;
120 }
121
122 //-----------------------------------------------------------------------------------
123
124 void DecimaterInfo::setEdgeLengthConstraint( double _value ){
125
126 edgeLength_ = true;
127 edgeLength_value_ = _value;
128 }
129
130 //-----------------------------------------------------------------------------------
131
132 void DecimaterInfo::setDecimationOrder( DecimationOrder _order ){
133
134 decimationOrder_ = _order;
135 }
136
137 //-----------------------------------------------------------------------------------
138
139 void DecimaterInfo::removeDistanceConstraint(){
140
141 if ( distance_ ) {
142 distance_ = false;
143 distance_value_ = 0;
144 }
145 }
146
147
148 //-----------------------------------------------------------------------------------
149
150 void DecimaterInfo::removeEdgeLengthConstraint(){
151
152 if ( edgeLength_ ) {
153 edgeLength_ = false;
154 edgeLength_value_ = 0;
155 }
156 }
157
158
159 //-----------------------------------------------------------------------------------
160
161 void DecimaterInfo::removeNormalDeviationConstraint(){
162
163 if ( normalDeviation_ ) {
164 normalDeviation_ = false;
165 normalDeviation_value_ = 0;
166 }
167 }
168
169
170 //-----------------------------------------------------------------------------------
171
172 void DecimaterInfo::removeNormalFlippingConstraint(){
173
174 if ( normalFlipping_ ) {
175 normalFlipping_ = false;
176 }
177 }
178
179
180 //-----------------------------------------------------------------------------------
181
182 void DecimaterInfo::removeIndependentSetsConstraint(){
183
184 if ( independentSets_ ) {
185 independentSets_ = false;
186 }
187 }
188
189
190 //-----------------------------------------------------------------------------------
191
192 void DecimaterInfo::removeAspectRatioConstraint(){
193
194 if ( aspectRatio_ ) {
195 aspectRatio_ = false;
196 aspectRatio_value_ = 0;
197 }
198 }
199
200
201 //-----------------------------------------------------------------------------------
202
203 void DecimaterInfo::removeRoundnessConstraint(){
204
205 if ( roundness_ ) {
206 roundness_ = false;
207 roundness_value_ = 0;
208 }
209 }
210
211
PerObjectData
Object Payload.
Definition: perObjectData.hh:73
DecimaterInfo::copyPerObjectData
PerObjectData * copyPerObjectData()
Copy Function.
Definition: DecimaterInfo.cc:65
DecimaterInfo
Definition: DecimaterInfo.hh:47