Example of a test. To be completed.
51{
52 unsigned int nbok = 0;
53 unsigned int nb = 0;
54
56 typedef std::vector<Point> Container;
57
58
60 OrientationFunctor orientationFunctor;
62 predicate( orientationFunctor );
63
64
65 using namespace functions::Hull2D;
66
68
70 {
74 nbok++;
75 nb++;
76 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
77 }
78
80 {
82 input.push_back(
Point(1,1) );
84 if ( (
output.size() == 1) &&
86 nbok++;
87 nb++;
88 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
89 }
90
92 {
94 input.push_back(
Point(1,1) );
95 input.push_back(
Point(1,2) );
97 if ( (
output.size() == 2) &&
100 nbok++;
101 nb++;
102 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
103 }
104
106 {
108
109
110 input.push_back(
Point(0,0) );
111 input.push_back(
Point(5,0) );
112 input.push_back(
Point(10,5) );
113 copy( input.begin(), input.end(), ostream_iterator<Point>( cout, " " ) );
114 cout << endl;
115
117
118 copy(
output.begin(),
output.end(), ostream_iterator<Point>( cout,
" " ) );
119 cout << endl;
120
121 if ( (
output.size() == 3) &&
125 nbok++;
126 nb++;
127 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
128
129
131 input.at(2) =
Point(10,-5);
132 copy( input.begin(), input.end(), ostream_iterator<Point>( cout, " " ) );
133 cout << endl;
134
136
137 copy(
output.begin(),
output.end(), ostream_iterator<Point>( cout,
" " ) );
138 cout << endl;
139
140 if ( (
output.size() == 2) &&
143 nbok++;
144 nb++;
145 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
146 }
147
148 trace.
info() <<
"several points" << endl;
149 {
151 input.push_back(
Point(0,5) );
152 input.push_back(
Point(0,0) );
153 input.push_back(
Point(1,1) );
154 input.push_back(
Point(2,4) );
155 input.push_back(
Point(3,9) );
156 input.push_back(
Point(4,16) );
157 input.push_back(
Point(5,0) );
158
160 if ( (
output.size() == 2) &&
163 nbok++;
164 nb++;
165 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
166
169 if ( (
output.size() == 3) &&
173 nbok++;
174 nb++;
175 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
176
177 }
178
180
182
184 {
188 nbok++;
189 nb++;
190 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
191 }
192
194 {
196 input.push_back(
Point(1,1) );
198 if ( (
output.size() == 1) &&
200 nbok++;
201 nb++;
202 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
203 }
204
206 {
208 input.push_back(
Point(1,1) );
209 input.push_back(
Point(1,2) );
211 if ( (
output.size() == 2) &&
214 nbok++;
215 nb++;
216 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
217 }
218
220 {
221
223 input.push_back(
Point(0,0) );
224 input.push_back(
Point(5,0) );
225 input.push_back(
Point(10,5) );
226 copy( input.begin(), input.end(), ostream_iterator<Point>( cout, " " ) );
227 cout << endl;
228
230
231 copy(
output.begin(),
output.end(), ostream_iterator<Point>( cout,
" " ) );
232 cout << endl;
233
234 if ( (
output.size() == 3) &&
238 nbok++;
239 nb++;
240 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
241 }
242
243 trace.
info() <<
"taking into account the first point" << endl;
244 {
246 input.push_back(
Point(0,-1) );
247 input.push_back(
Point(1,0) );
248 input.push_back(
Point(1,5) );
249 input.push_back(
Point(-5,5) );
250 input.push_back(
Point(-5,0) );
251 input.push_back(
Point(-2,1) );
252 copy( input.begin(), input.end(), ostream_iterator<Point>( cout, " " ) );
253 cout << endl;
254
256
257 copy(
output.begin(),
output.end(), ostream_iterator<Point>( cout,
" " ) );
258 cout << endl;
259
260 if ( (
output.size() == 5) &&
266 nbok++;
267 nb++;
268 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
269 }
270
272
274
276 {
280 nbok++;
281 nb++;
282 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
283 }
284
286 {
288 input.push_back(
Point(1,1) );
290 if ( (
output.size() == 1) &&
292 nbok++;
293 nb++;
294 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
295 }
296
298 {
300 input.push_back(
Point(1,1) );
301 input.push_back(
Point(1,2) );
303 if ( (
output.size() == 2) &&
306 nbok++;
307 nb++;
308 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
309 }
310
312 {
313
315 input.push_back(
Point(0,0) );
316 input.push_back(
Point(5,0) );
317 input.push_back(
Point(10,5) );
318 copy( input.begin(), input.end(), ostream_iterator<Point>( cout, " " ) );
319 cout << endl;
320
322
323 copy(
output.begin(),
output.end(), ostream_iterator<Point>( cout,
" " ) );
324 cout << endl;
325
326 if ( (
output.size() == 3) &&
330 nbok++;
331 nb++;
332 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
333 }
334
335 trace.
info() <<
"taking into account the first point" << endl;
336 {
338 input.push_back(
Point(3,2) );
339 input.push_back(
Point(2,2) );
340 input.push_back(
Point(2,1) );
341 input.push_back(
Point(1,1) );
342 input.push_back(
Point(0,1) );
343 input.push_back(
Point(0,0) );
344 input.push_back(
Point(9,0) );
345 input.push_back(
Point(9,6) );
346 input.push_back(
Point(8,6) );
347 input.push_back(
Point(8,5) );
348 input.push_back(
Point(7,5) );
349 input.push_back(
Point(7,4) );
350 input.push_back(
Point(6,4) );
351 input.push_back(
Point(5,4) );
352 input.push_back(
Point(5,3) );
353 input.push_back(
Point(4,3) );
354 input.push_back(
Point(4,2) );
355
356 copy( input.begin(), input.end(), ostream_iterator<Point>( cout, " " ) );
357 cout << endl;
358
360
361 copy(
output.begin(),
output.end(), ostream_iterator<Point>( cout,
" " ) );
362 cout << endl;
363
364 if ( (
output.size() == 5) &&
370 nbok++;
371 nb++;
372 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
373 }
374
376
377 return nbok == nb;
378}
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: Small adapter to models of COrientationFunctor2. It is a model of concepts::CPointPredicate....
void closedGrahamScanFromAnyPoint(const ForwardIterator &itb, const ForwardIterator &ite, OutputIterator res, const Predicate &aPredicate)
Procedure that retrieves the vertices of the convex hull of a weakly externally visible polygon (WEVP...
void openGrahamScan(const ForwardIterator &itb, const ForwardIterator &ite, OutputIterator res, const Predicate &aPredicate)
Procedure that retrieves the vertices of the convex hull of a weakly externally visible polygon (WEVP...
void closedGrahamScanFromVertex(const ForwardIterator &itb, const ForwardIterator &ite, OutputIterator res, const Predicate &aPredicate)
Procedure that retrieves the vertices of the convex hull of a weakly externally visible polygon (WEVP...
AxisDomainSplitter< Domain >::SplitDomainsInfo output