DGtal  1.5.beta
testChamferDT.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
32 #include <set>
33 #include <algorithm>
34 #include "DGtal/base/Common.h"
35 #include "ConfigTest.h"
36 #include "DGtal/helpers/StdDefs.h"
37 #include "DGtal/geometry/volumes/distance/ChamferNorm2D.h"
38 #include "DGtal/geometry/volumes/distance/CMetricSpace.h"
39 #include "DGtal/geometry/volumes/distance/CSeparableMetric.h"
41 
42 using namespace DGtal;
43 using namespace Z2i;
44 
46 // Functions for testing class ChamferDT.
48 
49 
50 
52 {
55  return true;
56 }
57 
58 
60 {
61  unsigned int nbok = 0;
62  unsigned int nb = 0;
63  trace.beginBlock ( "Testing simple chamfer mask localization...");
64 
67 
70 
71  //3-4 mask
72  dirs34.push_back(Z2i::Vector(0,-1));
73  dirs34.push_back(Z2i::Vector(1,-1));
74  dirs34.push_back(Z2i::Vector(1,0));
75  dirs34.push_back(Z2i::Vector(1,1));
76  normals34.push_back(Z2i::Vector(1,-3));
77  normals34.push_back(Z2i::Vector(3,-1));
78  normals34.push_back(Z2i::Vector(3,1));
79  normals34.push_back(Z2i::Vector(1,3));
80 
81  experimental::ChamferNorm2D<Space> aMask(dirs34,normals34);
82 
83 
84 
85 
86  //Testing cone discovery
87  Vector d(101,100);
88  trace.info() << "Direction "<<d<<std::endl;
89  trace.info() << " -> cone "<< *aMask.getCone(d)
90  << " -- " << *(aMask.getCone(d)+1) <<std::endl;
91  nbok += ( lthan(d, *(aMask.getCone(d)+1))) ? 1 : 0;
92  nb++;
93  trace.info() << "(" << nbok << "/" << nb << ") "
94  << "(d < cone+1) returns true" << std::endl;
95  nbok += (lqthan(*(aMask.getCone(d)),d)) ? 1 : 0;
96  nb++;
97  trace.info() << "(" << nbok << "/" << nb << ") "
98  << "(cone <= d) returns true" << std::endl;
99 
100  //testing canonical
101  Vector d3(-101,100);
102  trace.info() << "Direction "<<d3<<std::endl;
103  trace.info() << " -> cone "<< *aMask.getCone(d3)
104  << " -- " << *(aMask.getCone(d3)+1) <<std::endl;
105  nbok += ( lthan(aMask.canonicalRay(d3), *(aMask.getCone(d3)+1))) ? 1 : 0;
106  nb++;
107  trace.info() << "(" << nbok << "/" << nb << ") "
108  << "(d < cone+1) returns true" << std::endl;
109  nbok += (lqthan(*(aMask.getCone(d3)),aMask.canonicalRay(d3))) ? 1 : 0;
110  nb++;
111  trace.info() << "(" << nbok << "/" << nb << ") "
112  << "(cone <= d) returns true" << std::endl;
113 
114 
115  //aligned
116  Vector d2(8,8);
117  trace.info() << "Direction "<<d2<<std::endl;
118  trace.info() << " -> cone "<< *aMask.getCone(d2)
119  << " -- " << *(aMask.getCone(d2)+1) <<std::endl;
120  if ((aMask.getCone(d2)+1) != aMask.end())
121  {
122  nbok += ( lthan(d2, *(aMask.getCone(d2)+1))) ? 1 : 0;
123  nb++;
124  trace.info() << "(" << nbok << "/" << nb << ") "
125  << "(d2 < cone+1) returns true" << std::endl;
126  }
127  nbok += (lqthan(*(aMask.getCone(d2)),d2) ) ? 1 : 0;
128  nb++;
129  trace.info() << "(" << nbok << "/" << nb << ") "
130  << "(cone <= d2) returns true" << std::endl;
131 
132 
133  //Distance test
134  Point p(1,1), q(102,101);
135  trace.info()<< "Distance between "<<p<<" and "<< q << " = "<< aMask(p,q)<<std::endl;
136  trace.info()<< "Distance between "<<q<<" and "<< p << " = "<< aMask(q,p)<<std::endl;
137  nbok += ( aMask(p,q) == aMask(q,p)) ? 1 : 0;
138  nb++;
139  trace.info() << "(" << nbok << "/" << nb << ") "
140  << "d(p,q)==d(q,p)" << std::endl;
141 
142 
143  //Testing Last cone:
144  Vector d4(1,10);
145  trace.info() << "Direction "<<d4<<std::endl;
146  trace.info() << " -> cone "<< *aMask.getCone(d4)
147  << " -- " << *(aMask.getCone(d4)+1) <<std::endl;
148  nbok += ( *aMask.getCone(d4) == Point(1,1)) ? 1 : 0;
149  nb++;
150  trace.info() << "(" << nbok << "/" << nb << ") "
151  << "Last cone 1" << std::endl;
152  trace.info() << " -> normal "<< aMask.getNormalFromCone(aMask.getCone(d4)) <<std::endl;;
153  nbok += (aMask.getNormalFromCone(aMask.getCone(d4)) == Point(1,3)) ? 1 : 0;
154  nb++;
155  trace.info() << "(" << nbok << "/" << nb << ") "
156  << "Last cone 2" << std::endl;
157 
158  //Testing Last cone:
159  Vector d5(0,10);
160  trace.info() << "Direction "<<d5<<std::endl;
161  trace.info() << " -> cone "<< *aMask.getCone(d5)
162  << " -- " << *(aMask.getCone(d5)+1) <<std::endl;
163  nbok += ( *aMask.getCone(d5) == Point(1,1)) ? 1 : 0;
164  nb++;
165  trace.info() << "(" << nbok << "/" << nb << ") "
166  << "Last cone 1" << std::endl;
167  trace.info() << " -> normal "<< aMask.getNormalFromCone(aMask.getCone(d5)) <<std::endl;;
168  nbok += (aMask.getNormalFromCone(aMask.getCone(d5)) == Point(1,3)) ? 1 : 0;
169  nb++;
170  trace.info() << "(" << nbok << "/" << nb << ") "
171  << "Last cone 2" << std::endl;
172 
173  trace.info() << " upper="<<*std::upper_bound(aMask.begin(), aMask.end(), d4, lthan)<<std::endl;
174 
175  trace.endBlock();
176  return nbok == nb;
177 }
178 
180 {
181  unsigned int nbok = 0;
182  unsigned int nb = 0;
183  trace.beginBlock ( "Testing basic chamfer masks...");
184 
187 
188  //3-4 mask
189  dirs34.push_back(Z2i::Vector(0,-1));
190  dirs34.push_back(Z2i::Vector(1,-1));
191  dirs34.push_back(Z2i::Vector(1,0));
192  dirs34.push_back(Z2i::Vector(1,1));
193  normals34.push_back(Z2i::Vector(1,-3));
194  normals34.push_back(Z2i::Vector(3,-1));
195  normals34.push_back(Z2i::Vector(3,1));
196  normals34.push_back(Z2i::Vector(1,3));
197 
198  experimental::ChamferNorm2D<Space> mask34(dirs34,normals34);
199 
200  Point orig(0,0);
201  Point p(3,0);
202  trace.info() <<"Distance "<<p<<" = "<< mask34(orig,p)<<std::endl;;
203  trace.info() <<"Cone "<< *(mask34.getCone(p))<< " "<< *(mask34.getCone(p)+1)<< std::endl;
204 
205  Point q(3,1);
206  trace.info() <<"Distance "<<q<<" = "<< mask34(orig,q)<<std::endl;;
207  trace.info() <<"Cone "<< *(mask34.getCone(q))<< " "<< *(mask34.getCone(q)+1)<< std::endl;
208 
209 
210  trace.endBlock();
211  return nbok == nb;
212 }
213 
215 {
216  unsigned int nbok = 0;
217  unsigned int nb = 0;
218  trace.beginBlock ( "Testing intersection...");
219 
220  Point P(0,0),Q(7,3),Qb(7,-3), Q2(2, -10), Q3(2,10);
221  Point Lmin(10,-10), Lmax(10,10);
223 
224  trace.info() << "Intersection "<<P<<" "<<Q<<" = "
225  << mask.getLowerRayIntersection(P,Q,Lmin,Lmax, 1)<<std::endl;
226  nbok += ( mask.getLowerRayIntersection(P,Q,Lmin,Lmax, 1) == 4) ? 1 : 0;
227  nb++;
228  trace.info() << "(" << nbok << "/" << nb << ") "
229  << "inter==4" << std::endl;
230 
231  trace.info() << "Intersection "<<P<<" "<<Qb<<" = "
232  << mask.getLowerRayIntersection(P,Qb,Lmin,Lmax, 1)<<std::endl;
233  nbok += ( mask.getLowerRayIntersection(P,Qb,Lmin,Lmax, 1) == -5) ? 1 : 0;
234  nb++;
235  trace.info() << "(" << nbok << "/" << nb << ") "
236  << "inter==-5" << std::endl;
237 
238  trace.info() << "Intersection "<<P<<" "<<Q2<<" = "
239  << mask.getLowerRayIntersection(P,Q2,Lmin,Lmax, 1)<<std::endl;
240  nbok += ( mask.getLowerRayIntersection(P,Q2,Lmin,Lmax, 1) <= Lmin[1]) ? 1 : 0;
241  nb++;
242  trace.info() << "(" << nbok << "/" << nb << ") "
243  << "inter==Lmin" << std::endl;
244 
245  trace.info() << "Intersection "<<P<<" "<<Q3<<" = "
246  << mask.getLowerRayIntersection(P,Q3,Lmin,Lmax, 1)<<std::endl;
247  nbok += ( mask.getLowerRayIntersection(P,Q3,Lmin,Lmax, 1) >= Lmax[1]) ? 1 : 0;
248  nb++;
249  trace.info() << "(" << nbok << "/" << nb << ") "
250  << "inter==Lmax" << std::endl;
251 
252  trace.info()<<std::endl;
253 
254  Point PP(0,0),QQ(3,7),QQb(-3,7), QQ2(-10, 2), QQ3(10, 2);
255  Point LLmin(-10,10), LLmax(10,10);
256 
257  trace.info() << "Intersection "<<PP<<" "<<QQ<<" = "
258  << mask.getLowerRayIntersection(PP,QQ,LLmin,LLmax, 0)<<std::endl;
259  nbok += ( mask.getLowerRayIntersection(PP,QQ,LLmin,LLmax, 0) == 4) ? 1 : 0;
260  nb++;
261  trace.info() << "(" << nbok << "/" << nb << ") "
262  << "inter==4" << std::endl;
263 
264  trace.info() << "Intersection "<<PP<<" "<<QQb<<" = "
265  << mask.getLowerRayIntersection(PP,QQb,LLmin,LLmax, 0)<<std::endl;
266  nbok += ( mask.getLowerRayIntersection(PP,QQb,LLmin,LLmax, 0) == -5) ? 1 : 0;
267  nb++;
268  trace.info() << "(" << nbok << "/" << nb << ") "
269  << "inter==-5" << std::endl;
270 
271  trace.info() << "Intersection "<<PP<<" "<<QQ2<<" = "
272  << mask.getLowerRayIntersection(PP,QQ2,LLmin,LLmax, 0)<<std::endl;
273  nbok += ( mask.getLowerRayIntersection(PP,QQ2,LLmin,LLmax, 0) <= LLmin[0]) ? 1 : 0;
274  nb++;
275  trace.info() << "(" << nbok << "/" << nb << ") "
276  << "inter==Lmin" << std::endl;
277 
278  trace.info() << "Intersection "<<PP<<" "<<QQ3<<" = "
279  << mask.getLowerRayIntersection(PP,QQ3,LLmin,LLmax, 0)<<std::endl;
280  nbok += ( mask.getLowerRayIntersection(PP,QQ3,LLmin,LLmax, 0) >= LLmax[0]) ? 1 : 0;
281  nb++;
282  trace.info() << "(" << nbok << "/" << nb << ") "
283  << "inter==Lmax" << std::endl;
284 
285  return nbok == nb;
286 }
287 
288 
290 {
291  unsigned int nbok = 0;
292  unsigned int nb = 0;
293  trace.beginBlock ( "Testing shrinking...");
294 
295  //5-7-11 metic
297  Metric::Directions dirs5711;
298  Metric::Directions normals5711;
299  //5-7-11 mask
300  dirs5711.push_back(Z2i::Vector(0,-1));
301  dirs5711.push_back(Z2i::Vector(1,-2));
302  dirs5711.push_back(Z2i::Vector(1,-1));
303  dirs5711.push_back(Z2i::Vector(2,-1));
304  dirs5711.push_back(Z2i::Vector(1,0));
305  dirs5711.push_back(Z2i::Vector(2,1));
306  dirs5711.push_back(Z2i::Vector(1,1));
307  dirs5711.push_back(Z2i::Vector(1,2));
308 
309  normals5711.push_back(Z2i::Vector(1,-5));
310  normals5711.push_back(Z2i::Vector(3,-4));
311  normals5711.push_back(Z2i::Vector(4,-3));
312  normals5711.push_back(Z2i::Vector(5,-1));
313  normals5711.push_back(Z2i::Vector(5,1));
314  normals5711.push_back(Z2i::Vector(4,3));
315  normals5711.push_back(Z2i::Vector(3,4));
316  normals5711.push_back(Z2i::Vector(1,5));
317 
318  Metric mask5711(dirs5711,normals5711);
319 
320  //Setting:
321  Point P(0,0);
322  Point Q(1,-2), QQ(1,2);
323  Point Lmin(10,0);
324  Point Lmax(10,10);
325  Metric::ConstIterator itBeg = mask5711.begin();
326  Metric::ConstIterator itEnd = mask5711.end();
327 
328  Point midPoint, nextMidPoint;
329 
330  Metric::ConstIterator cone = mask5711.shrinkPSubMask(itBeg, itEnd, P, Q, Lmin, Lmax, 1, midPoint, nextMidPoint);
331  trace.info() <<"Shrink returns the cone "<< *cone<<" " <<*(cone+1)<<std::endl;
332  trace.info() <<"MidPoint "<< midPoint<<" " <<nextMidPoint<<std::endl<<std::endl;
333  nbok += ( midPoint == Point(10,0)) ? 1 : 0;
334  nb++;
335  trace.info() << "(" << nbok << "/" << nb << ") "
336  << "midPoint = (10,0)" << std::endl;
337  nbok += ( nextMidPoint == Point(10,5)) ? 1 : 0;
338  nb++;
339  trace.info() << "(" << nbok << "/" << nb << ") "
340  << "nextMidPoint = (10,5)" << std::endl;
341 
342 
343  trace.warning()<<" Shrinking with QQ(1,2)"<<std::endl;
344 
345  Metric::ConstIterator cone2 = mask5711.shrinkPSubMask(itBeg, itEnd, P, QQ, Lmin, Lmax, 1, midPoint, nextMidPoint);
346  trace.info() <<"Shrink returns the cone2 "<< *cone2<<" " <<*(cone2+1)<<std::endl;
347  trace.info() <<"MidPoint "<< midPoint<<" " <<nextMidPoint<<std::endl<<std::endl;
348  nbok += ( midPoint == Point(10,-5)) ? 1 : 0;
349  nb++;
350  trace.info() << "(" << nbok << "/" << nb << ") "
351  << "midPoint = (10,0)" << std::endl;
352  nbok += ( nextMidPoint == Point(10,0)) ? 1 : 0;
353  nb++;
354  trace.info() << "(" << nbok << "/" << nb << ") "
355  << "nextMidPoint = (10,5)" << std::endl;
356 
357 
358  trace.beginBlock("Testing Symmetry");
359  Point LLmin(-10,0);
360  Point LLmax(-10,10);
361  Point QQQ(-1,-2);
362  Metric::ConstIterator cone3 = mask5711.shrinkP(itBeg, itEnd, P, QQQ, LLmin, LLmax, 1, midPoint, nextMidPoint);
363  trace.info() <<"Shrink returns the cone3 "<< *cone3<<" " <<*(cone3+1)<<std::endl;
364  trace.info() <<"MidPoint "<< midPoint<<" " <<nextMidPoint<<std::endl<<std::endl;
365  nbok += ( midPoint == Point(-10,0)) ? 1 : 0;
366  nb++;
367  trace.info() << "(" << nbok << "/" << nb << ") "
368  << "midPoint = (-10,0)" << std::endl;
369  nbok += ( nextMidPoint == Point(-10,5)) ? 1 : 0;
370  nb++;
371  trace.info() << "(" << nbok << "/" << nb << ") "
372  << "nextMidPoint = (-10,5)" << std::endl;
373  trace.endBlock();
374 
375  //horizontal
376  trace.beginBlock("Testing H/V symmetry");
377  Point LLLmin(0,10);
378  Point LLLmax(10,10);
379  Point Qhori(-2,1);
380  Metric::ConstIterator cone4 = mask5711.shrinkP(itBeg, itEnd, P, Qhori, LLLmin, LLLmax, 0, midPoint, nextMidPoint);
381  trace.info() <<"Shrink returns the cone3 "<< *cone4<<" " <<*(cone4+1)<<std::endl;
382  trace.info() <<"MidPoint "<< midPoint<<" " <<nextMidPoint<<std::endl<<std::endl;
383  nbok += ( *cone4 == *cone) ? 1 : 0;
384  nb++;
385  trace.info() << "(" << nbok << "/" << nb << ") "
386  << "horiz==vert" << std::endl;
387  nbok += ( midPoint == Point(0,10)) ? 1 : 0;
388  nb++;
389  trace.info() << "(" << nbok << "/" << nb << ") "
390  << "midPoint = (0,10)" << std::endl;
391  nbok += ( nextMidPoint == Point(5,10)) ? 1 : 0;
392  nb++;
393  trace.info() << "(" << nbok << "/" << nb << ") "
394  << "nextMidPoint = (5,10)" << std::endl;
395 
396  Point LLLLmin(0,-10);
397  Point LLLLmax(10,-10);
398  Point QQhori(-2,-1);
399  Metric::ConstIterator cone5 = mask5711.shrinkP(itBeg, itEnd, P, QQhori, LLLLmin, LLLLmax, 0, midPoint, nextMidPoint);
400  trace.info() <<"Shrink returns the cone3 "<< *cone4<<" " <<*(cone4+1)<<std::endl;
401  trace.info() <<"MidPoint "<< midPoint<<" " <<nextMidPoint<<std::endl;
402  nbok += ( *cone5 == *cone) ? 1 : 0;
403  nb++;
404  trace.info() << "(" << nbok << "/" << nb << ") "
405  << "horiz==vert" << std::endl;
406  nbok += ( midPoint == Point(0,-10)) ? 1 : 0;
407  nb++;
408  trace.info() << "(" << nbok << "/" << nb << ") "
409  << "midPoint = (0,-10)" << std::endl;
410  nbok += ( nextMidPoint == Point(5,-10)) ? 1 : 0;
411  nb++;
412  trace.info() << "(" << nbok << "/" << nb << ") "
413  << "nextMidPoint = (5,-10)" << std::endl;
414  trace.endBlock();
415 
416  trace.endBlock();
417  return nbok == nb;
418 }
420 {
421  unsigned int nbok = 0;
422  unsigned int nb = 0;
423  trace.beginBlock ( "Testing Double Shrinking...");
424 
425  //5-7-11 metic
427  Metric::Directions dirs5711;
428  Metric::Directions normals5711;
429  //5-7-11 mask
430  dirs5711.push_back(Z2i::Vector(0,-1));
431  dirs5711.push_back(Z2i::Vector(1,-2));
432  dirs5711.push_back(Z2i::Vector(1,-1));
433  dirs5711.push_back(Z2i::Vector(2,-1));
434  dirs5711.push_back(Z2i::Vector(1,0));
435  dirs5711.push_back(Z2i::Vector(2,1));
436  dirs5711.push_back(Z2i::Vector(1,1));
437  dirs5711.push_back(Z2i::Vector(1,2));
438 
439  normals5711.push_back(Z2i::Vector(1,-5));
440  normals5711.push_back(Z2i::Vector(3,-4));
441  normals5711.push_back(Z2i::Vector(4,-3));
442  normals5711.push_back(Z2i::Vector(5,-1));
443  normals5711.push_back(Z2i::Vector(5,1));
444  normals5711.push_back(Z2i::Vector(4,3));
445  normals5711.push_back(Z2i::Vector(3,4));
446  normals5711.push_back(Z2i::Vector(1,5));
447 
448  Metric mask5711(dirs5711,normals5711);
449 
450  //Setting:
451  trace.beginBlock("Tessting shrinking using Q");
452  Point P(0,0);
453  Point Q(1,-2), QQ(1,2);
454  Point Lmin(10,-10);
455  Point Lmax(10,10);
456  Point midPointP,nextMidPointP;
457  Point midPointQ,nextMidPointQ;
458 
459  Metric::ConstIterator itBeg = mask5711.begin();
460  Metric::ConstIterator itEnd = mask5711.end();
461 
462  Metric::ConstIterator cone = mask5711.shrinkP(itBeg, itEnd, P, Q, Lmin, Lmax, 1, midPointP, nextMidPointP);
463  trace.info() <<" P - Shrink returns the cone "<< *cone<<" " <<*(cone+1)<<std::endl;
464  trace.info() <<" P - MidPoint "<< midPointP<<" " <<nextMidPointP<<std::endl<<std::endl;
465 
466  Metric::ConstIterator cone2 = mask5711.shrinkP(itBeg, itEnd, Q, P, Lmin, Lmax, 1, midPointQ, nextMidPointQ);
467  trace.info() <<" Q - Shrink returns the cone "<< *cone2<<" " <<*(cone2+1)<<std::endl;
468  trace.info() <<" Q - MidPoint "<< midPointQ<<" " <<nextMidPointQ<<std::endl<<std::endl;
469  trace.info() << "Checking Voro cell" <<std::endl;
470 
471  double dpmidp = mask5711(P,midPointP);
472  double dqmidp = mask5711(Q,midPointP);
473  trace.info() << ((dpmidp < dqmidp) ? "MidP closer to P" : "Mid closer to Q") << std::endl;
474  double dpnextmidp = mask5711(P,nextMidPointP);
475  double dqnextmidp = mask5711(Q,nextMidPointP);
476  trace.info() << ((dpnextmidp < dqnextmidp) ? "NextMidP closer to P" : "Mid closer to Q") << std::endl;
477  nbok += ( (dpmidp < dqmidp) != (dpnextmidp < dqnextmidp)) ? 1 : 0;
478  nb++;
479  trace.info() << "(" << nbok << "/" << nb << ") "
480  << " Shrink P contains the Voronoi Edge" << std::endl;
481 
482  double dpmidq = mask5711(P,midPointQ);
483  double dqmidq = mask5711(Q,midPointQ);
484  trace.info() << ((dpmidq < dqmidq) ? "MidQ closer to P" : "Mid closer to Q") << std::endl;
485  double dpnextmidq = mask5711(P,nextMidPointQ);
486  double dqnextmidq = mask5711(Q,nextMidPointQ);
487  trace.info() << ((dpnextmidq < dqnextmidq) ? "NextMidP closer to P" : "Mid closer to Q") << std::endl;
488  nbok += ( (dpmidq < dqmidq) != (dpnextmidq < dqnextmidq)) ? 1 : 0;
489  nb++;
490  trace.info() << "(" << nbok << "/" << nb << ") "
491  << " Shrink Q contains the Voronoi Edge" << std::endl;
492 
493  trace.beginBlock("Computing the lower");
494  Metric::Abscissa vorocell;
495  Metric::Vector normalP = mask5711.getNormalFromCone(cone);
496  Metric::Vector normalQ = mask5711.getNormalFromCone(cone2);
497  vorocell = static_cast<Metric::Abscissa>(floor((double) (P[1]*normalP[1] - Q[1]*normalQ[1] - (Lmin[0] - P[0])*normalP[0] + (Lmin[0] - Q[0])*normalQ[0]) /(normalP[1] - normalQ[1]) ));
498  Point voro(Lmin[0], vorocell);
499 
500  trace.emphase() << " Lower Voronoi Cell Point "<< voro << " absc = "<<vorocell<<std::endl;
501  nbok += ( (voro >= midPointP) && (voro<nextMidPointP)) ? 1 : 0;
502  nb++;
503  trace.info() << "(" << nbok << "/" << nb << ") "
504  << " Voro cell in the cone of P" << std::endl;
505  nbok += ( (voro >= midPointQ) && (voro<nextMidPointQ)) ? 1 : 0;
506  nb++;
507  trace.info() << "(" << nbok << "/" << nb << ") "
508  << " Voro cell in the cone of Q" << std::endl;
509 
510 
511  nbok += ( (vorocell == mask5711.getLowerVoronoiEdgeAbscissa(P, Q, Lmin, Lmax, 1))) ? 1 : 0;
512  nb++;
513  trace.info() << "(" << nbok << "/" << nb << ") "
514  << " Voro cell == getLowerVoronoiEdgeAbscissa " << std::endl;
515 
516  trace.endBlock();
517 
518  trace.endBlock();
519 
520 
521  //Setting2
522  trace.beginBlock("Testing double shrinking on QQ");
523  Metric::ConstIterator coneQQ = mask5711.shrinkP(itBeg, itEnd, P, QQ, Lmin, Lmax, 1, midPointP, nextMidPointP);
524  trace.info() <<" P - Shrink returns the cone "<< *coneQQ<<" " <<*(coneQQ+1)<<std::endl;
525  trace.info() <<" P - MidPoint "<< midPointP<<" " <<nextMidPointP<<std::endl;
526  trace.info() <<" P - cone distance to P("<< mask5711(midPointP,P)<<","
527  << mask5711(nextMidPointP,P)<<")" <<std::endl;
528  trace.info() <<" P - cone distance to QQ("<< mask5711(midPointP,QQ)<<","
529  << mask5711(nextMidPointP,QQ)<<")" <<std::endl<<std::endl;
530 
531  Metric::ConstIterator coneQQ2 = mask5711.shrinkP(itBeg, itEnd, QQ, P, Lmin, Lmax, 1, midPointQ, nextMidPointQ);
532  trace.info() <<" QQ - Shrink returns the cone "<< *coneQQ2<<" " <<*(coneQQ2+1)<<std::endl;
533  trace.info() <<" QQ - MidPoint "<< midPointQ<<" " <<nextMidPointQ<<std::endl;
534  trace.info() <<" QQ - cone distance to QQ("<< mask5711(midPointQ,QQ)<<","
535  << mask5711(nextMidPointQ,QQ)<<")" <<std::endl;
536  trace.info() <<" QQ - cone distance to P("<< mask5711(midPointQ,P)<<","
537  << mask5711(nextMidPointQ,P)<<")" <<std::endl;
538  trace.info() << "Checking Voro cell" <<std::endl<<std::endl;
539 
540  dpmidp = mask5711(P,midPointP);
541  dqmidp = mask5711(QQ,midPointP);
542  trace.info() << ((dpmidp < dqmidp) ? "MidP closer to P" : "MidP closer to QQ") << std::endl;
543  dpnextmidp = mask5711(P,nextMidPointP);
544  dqnextmidp = mask5711(QQ,nextMidPointP);
545  trace.info() << ((dpnextmidp < dqnextmidp) ? "NextMidP closer to P" : "NextMidP closer to QQ") << std::endl;
546  nbok += ( (dpmidp < dqmidp) != (dpnextmidp < dqnextmidp)) ? 1 : 0;
547  nb++;
548  trace.info() << "(" << nbok << "/" << nb << ") "
549  << " Shrink P contains the Voronoi Edge" << std::endl;
550  trace.info()<< "Distances : ConeP<->P("<<dpmidp<<","<<dpnextmidp<<") ConeP<->Q("<<dqmidp<<","<<dqnextmidp<<")"<<std::endl;
551 
552 
553  dpmidq = mask5711(P,midPointQ);
554  dqmidq = mask5711(QQ,midPointQ);
555  trace.info() << ((dpmidq < dqmidq) ? "MidQ closer to P" : "MidQ closer to QQ") << std::endl;
556  dpnextmidq = mask5711(P,nextMidPointQ);
557  dqnextmidq = mask5711(QQ,nextMidPointQ);
558  trace.info() << ((dpnextmidq < dqnextmidq) ? "NextMidQ closer to P" : "NextMidQ closer to QQ") << std::endl;
559  nbok += ( (dpmidq < dqmidq) != (dpnextmidq < dqnextmidq)) ? 1 : 0;
560  nb++;
561  trace.info() << "(" << nbok << "/" << nb << ") "
562  << " Shrink QQ contains the Voronoi Edge" << std::endl;
563  trace.info()<< "Distances : ConeQ<->P("<<dpmidq<<","<<dpnextmidq<<") ConeQ<->QQ("<<dqmidq<<","<<dqnextmidq<<")"<<std::endl;
564  trace.endBlock();
565 
566  trace.endBlock();
567 
568  return nbok == nb;
569 }
570 
571 
573 {
574  unsigned int nbok = 0;
575  unsigned int nb = 0;
576  trace.beginBlock ( "Testing Double Shrinking Horizontal...");
577 
578  //5-7-11 metic
580  Metric::Directions dirs5711;
581  Metric::Directions normals5711;
582  //5-7-11 mask
583  dirs5711.push_back(Z2i::Vector(0,-1));
584  dirs5711.push_back(Z2i::Vector(1,-2));
585  dirs5711.push_back(Z2i::Vector(1,-1));
586  dirs5711.push_back(Z2i::Vector(2,-1));
587  dirs5711.push_back(Z2i::Vector(1,0));
588  dirs5711.push_back(Z2i::Vector(2,1));
589  dirs5711.push_back(Z2i::Vector(1,1));
590  dirs5711.push_back(Z2i::Vector(1,2));
591 
592  normals5711.push_back(Z2i::Vector(1,-5));
593  normals5711.push_back(Z2i::Vector(3,-4));
594  normals5711.push_back(Z2i::Vector(4,-3));
595  normals5711.push_back(Z2i::Vector(5,-1));
596  normals5711.push_back(Z2i::Vector(5,1));
597  normals5711.push_back(Z2i::Vector(4,3));
598  normals5711.push_back(Z2i::Vector(3,4));
599  normals5711.push_back(Z2i::Vector(1,5));
600 
601  Metric mask5711(dirs5711,normals5711);
602 
603  //Setting:
604  trace.beginBlock("Testing shrinking using Q");
605  Point P(0,0);
606  Point Q(-2,1), QQ(2,1);
607  Point Lmin(-10,10);
608  Point Lmax(10,10);
609  Point midPointP,nextMidPointP;
610  Point midPointQ,nextMidPointQ;
611 
612  Metric::ConstIterator itBeg = mask5711.begin();
613  Metric::ConstIterator itEnd = mask5711.end();
614 
615  Metric::ConstIterator cone = mask5711.shrinkP(itBeg, itEnd, P, Q, Lmin, Lmax, 0, midPointP, nextMidPointP);
616  trace.info() <<" P - Shrink returns the cone "<< *cone<<" " <<*(cone+1)<<std::endl;
617  trace.info() <<" P - MidPoint "<< midPointP<<" " <<nextMidPointP<<std::endl<<std::endl;
618 
619  Metric::ConstIterator cone2 = mask5711.shrinkP(itBeg, itEnd, Q, P, Lmin, Lmax, 0, midPointQ, nextMidPointQ);
620  trace.info() <<" Q - Shrink returns the cone "<< *cone2<<" " <<*(cone2+1)<<std::endl;
621  trace.info() <<" Q - MidPoint "<< midPointQ<<" " <<nextMidPointQ<<std::endl<<std::endl;
622  trace.info() << "Checking Voro cell" <<std::endl;
623 
624 
625  double dpmidp = mask5711(P,midPointP);
626  double dqmidp = mask5711(Q,midPointP);
627  trace.info() << ((dpmidp < dqmidp) ? "MidP closer to P" : "Mid closer to Q") << std::endl;
628  double dpnextmidp = mask5711(P,nextMidPointP);
629  double dqnextmidp = mask5711(Q,nextMidPointP);
630  trace.info() << ((dpnextmidp < dqnextmidp) ? "NextMidP closer to P" : "Mid closer to Q") << std::endl;
631  nbok += ( (dpmidp < dqmidp) != (dpnextmidp < dqnextmidp)) ? 1 : 0;
632  nb++;
633  trace.info() << "(" << nbok << "/" << nb << ") "
634  << " Shrink P contains the Voronoi Edge" << std::endl;
635 
636 
637  double dpmidq = mask5711(P,midPointQ);
638  double dqmidq = mask5711(Q,midPointQ);
639  trace.info() << ((dpmidq < dqmidq) ? "MidQ closer to P" : "Mid closer to Q") << std::endl;
640  double dpnextmidq = mask5711(P,nextMidPointQ);
641  double dqnextmidq = mask5711(Q,nextMidPointQ);
642  trace.info() << ((dpnextmidq < dqnextmidq) ? "NextMidP closer to P" : "Mid closer to Q") << std::endl;
643  nbok += ( (dpmidq < dqmidq) != (dpnextmidq < dqnextmidq)) ? 1 : 0;
644  nb++;
645  trace.info() << "(" << nbok << "/" << nb << ") "
646  << " Shrink Q contains the Voronoi Edge" << std::endl;
647  trace.endBlock();
648 
649  //Setting2
650  trace.beginBlock("Testing double shrinking on QQ");
651  Metric::ConstIterator coneQQ = mask5711.shrinkP(itBeg, itEnd, P, QQ, Lmin, Lmax, 0, midPointP, nextMidPointP);
652  trace.info() <<" P - Shrink returns the cone "<< *coneQQ<<" " <<*(coneQQ+1)<<std::endl;
653  trace.info() <<" P - MidPoint "<< midPointP<<" " <<nextMidPointP<<std::endl;
654  trace.info() <<" P - cone distance to P("<< mask5711(midPointP,P)<<","
655  << mask5711(nextMidPointP,P)<<")" <<std::endl;
656  trace.info() <<" P - cone distance to QQ("<< mask5711(midPointP,QQ)<<","
657  << mask5711(nextMidPointP,QQ)<<")" <<std::endl<<std::endl;
658 
659  Metric::ConstIterator coneQQ2 = mask5711.shrinkP(itBeg, itEnd, QQ, P, Lmin, Lmax, 0, midPointQ, nextMidPointQ);
660  trace.info() <<" QQ - Shrink returns the cone "<< *coneQQ2<<" " <<*(coneQQ2+1)<<std::endl;
661  trace.info() <<" QQ - MidPoint "<< midPointQ<<" " <<nextMidPointQ<<std::endl;
662  trace.info() <<" QQ - cone distance to QQ("<< mask5711(midPointQ,QQ)<<","
663  << mask5711(nextMidPointQ,QQ)<<")" <<std::endl;
664  trace.info() <<" QQ - cone distance to P("<< mask5711(midPointQ,P)<<","
665  << mask5711(nextMidPointQ,P)<<")" <<std::endl;
666  trace.info() << "Checking Voro cell" <<std::endl<<std::endl;
667 
668  dpmidp = mask5711(P,midPointP);
669  dqmidp = mask5711(QQ,midPointP);
670  trace.info() << ((dpmidp < dqmidp) ? "MidP closer to P" : "MidP closer to QQ") << std::endl;
671  dpnextmidp = mask5711(P,nextMidPointP);
672  dqnextmidp = mask5711(QQ,nextMidPointP);
673  trace.info() << ((dpnextmidp < dqnextmidp) ? "NextMidP closer to P" : "NextMidP closer to QQ") << std::endl;
674  nbok += ( (dpmidp < dqmidp) != (dpnextmidp < dqnextmidp)) ? 1 : 0;
675  nb++;
676  trace.info() << "(" << nbok << "/" << nb << ") "
677  << " Shrink P contains the Voronoi Edge" << std::endl;
678  trace.info()<< "Distances : ConeP<->P("<<dpmidp<<","<<dpnextmidp<<") ConeP<->Q("<<dqmidp<<","<<dqnextmidp<<")"<<std::endl;
679 
680 
681  dpmidq = mask5711(P,midPointQ);
682  dqmidq = mask5711(QQ,midPointQ);
683  trace.info() << ((dpmidq < dqmidq) ? "MidQ closer to P" : "MidQ closer to QQ") << std::endl;
684  dpnextmidq = mask5711(P,nextMidPointQ);
685  dqnextmidq = mask5711(QQ,nextMidPointQ);
686  trace.info() << ((dpnextmidq < dqnextmidq) ? "NextMidQ closer to P" : "NextMidQ closer to QQ") << std::endl;
687  nbok += ( (dpmidq < dqmidq) != (dpnextmidq < dqnextmidq)) ? 1 : 0;
688  nb++;
689  trace.info() << "(" << nbok << "/" << nb << ") "
690  << " Shrink QQ contains the Voronoi Edge" << std::endl;
691  trace.info()<< "Distances : ConeQ<->P("<<dpmidq<<","<<dpnextmidq<<") ConeQ<->QQ("<<dqmidq<<","<<dqnextmidq<<")"<<std::endl;
692  trace.endBlock();
693 
694  trace.endBlock();
695 
696 
697  return nbok == nb;
698 }
699 
700 
702 {
703  unsigned int nbok = 0;
704  unsigned int nb = 0;
705  trace.beginBlock ( "Testing HiddenBy...");
706 
707  //5-7-11 metic
709  Metric::Directions dirs5711;
710  Metric::Directions normals5711;
711  //5-7-11 mask
712  dirs5711.push_back(Z2i::Vector(0,-1));
713  dirs5711.push_back(Z2i::Vector(1,-2));
714  dirs5711.push_back(Z2i::Vector(1,-1));
715  dirs5711.push_back(Z2i::Vector(2,-1));
716  dirs5711.push_back(Z2i::Vector(1,0));
717  dirs5711.push_back(Z2i::Vector(2,1));
718  dirs5711.push_back(Z2i::Vector(1,1));
719  dirs5711.push_back(Z2i::Vector(1,2));
720 
721  normals5711.push_back(Z2i::Vector(1,-5));
722  normals5711.push_back(Z2i::Vector(3,-4));
723  normals5711.push_back(Z2i::Vector(4,-3));
724  normals5711.push_back(Z2i::Vector(5,-1));
725  normals5711.push_back(Z2i::Vector(5,1));
726  normals5711.push_back(Z2i::Vector(4,3));
727  normals5711.push_back(Z2i::Vector(3,4));
728  normals5711.push_back(Z2i::Vector(1,5));
729 
730  Metric mask5711(dirs5711,normals5711);
731 
732  //Setting:
733  Point U(0,0);
734  Point V(0,3);
735  Point VV(-10,3);
736  Point W(0,6);
737  Point Lmin(10,-10);
738  Point Lmax(10,10);
739 
740  Point Usym(20,0);
741  Point Vsym(20,3);
742  Point VVsym(30,3);
743  Point Wsym(20,6);
744 
745  Point LminH(-10,10);
746  Point LmaxH(10,10);
747 
748  Point UH(0,0);
749  Point VH(3,0);
750  Point VVH(3,-10);
751  Point WH(6,0);
752 
753 
754  nbok += ( mask5711.hiddenBy(U,V, W, Lmin, Lmax, 1) == false ) ? 1 : 0;
755  nb++;
756  trace.info() << "(" << nbok << "/" << nb << ") "
757  << " H(U,V,W) is false" << std::endl;
758 
759  nbok += ( mask5711.hiddenBy(U,VV, W, Lmin, Lmax, 1) == true ) ? 1 : 0;
760  nb++;
761  trace.info() << "(" << nbok << "/" << nb << ") "
762  << " H(U,VV,W) is true" << std::endl;
763 
764  nbok += ( mask5711.hiddenBy(Usym,Vsym, Wsym, Lmin, Lmax, 1) == false ) ? 1 : 0;
765  nb++;
766  trace.info() << "(" << nbok << "/" << nb << ") "
767  << " H(Usym,Vsym,Wsym) is false" << std::endl;
768 
769  nbok += ( mask5711.hiddenBy(Usym,VVsym, Wsym, Lmin, Lmax, 1) == true ) ? 1 : 0;
770  nb++;
771  trace.info() << "(" << nbok << "/" << nb << ") "
772  << " H(Usym,VVsym,Wsym) is true" << std::endl;
773 
774  nbok += ( mask5711.hiddenBy(UH,VH, WH, LminH, LmaxH, 0) == false ) ? 1 : 0;
775  nb++;
776  trace.info() << "(" << nbok << "/" << nb << ") "
777  << " H(UH,VH,WH) is false" << std::endl;
778 
779  nbok += ( mask5711.hiddenBy(UH,VVH, WH, LminH, LmaxH, 0) == true ) ? 1 : 0;
780  nb++;
781  trace.info() << "(" << nbok << "/" << nb << ") "
782  << " H(UH,VVH,WH) is true" << std::endl;
783 
784  trace.endBlock();
785  return nb == nbok;
786 }
787 
788 
789 
791 {
792  unsigned int nbok = 0;
793  unsigned int nb = 0;
794 
795  //5-7-11 metic
797  Metric::Directions dirs5711;
798  Metric::Directions normals5711;
799  //5-7-11 mask
800  dirs5711.push_back(Z2i::Vector(0,-1));
801  dirs5711.push_back(Z2i::Vector(1,-2));
802  dirs5711.push_back(Z2i::Vector(1,-1));
803  dirs5711.push_back(Z2i::Vector(2,-1));
804  dirs5711.push_back(Z2i::Vector(1,0));
805  dirs5711.push_back(Z2i::Vector(2,1));
806  dirs5711.push_back(Z2i::Vector(1,1));
807  dirs5711.push_back(Z2i::Vector(1,2));
808 
809  normals5711.push_back(Z2i::Vector(1,-5));
810  normals5711.push_back(Z2i::Vector(3,-4));
811  normals5711.push_back(Z2i::Vector(4,-3));
812  normals5711.push_back(Z2i::Vector(5,-1));
813  normals5711.push_back(Z2i::Vector(5,1));
814  normals5711.push_back(Z2i::Vector(4,3));
815  normals5711.push_back(Z2i::Vector(3,4));
816  normals5711.push_back(Z2i::Vector(1,5));
817 
818  Metric mask5711(dirs5711,normals5711);
819 
820  trace.beginBlock ( "Testing when Q or P belongs to the segment...");
821  //Setting:
822  Point P(0,0);
823  Point Pb(0,-1);
824  Point Pup(0,10);
825  Point Q(10,5);
826  Point Lmin(10,-10);
827  Point Lmax(10,10);
828  Point midPointP,nextMidPointP;
829  Point midPointQ,nextMidPointQ;
830 
831  Metric::ConstIterator itBeg = mask5711.begin();
832  Metric::ConstIterator itEnd = mask5711.end();
833 
834  Metric::ConstIterator cone = mask5711.shrinkP(itBeg, itEnd, P, Q, Lmin, Lmax, 1, midPointP, nextMidPointP);
835  trace.info() <<" P - Shrink returns the cone "<< *cone<<" " <<*(cone+1)<<std::endl;
836  trace.info() <<" P - MidPoint "<< midPointP<<" " <<nextMidPointP<<std::endl<<std::endl;
837 
838 
839  Metric::ConstIterator cone2 = mask5711.shrinkP(itBeg, itEnd, Q, P, Lmin, Lmax, 1, midPointQ, nextMidPointQ);
840  Metric::ConstIterator cone3 = mask5711.shrinkP(itBeg, itEnd, Q, Pup, Lmin, Lmax, 1, midPointQ, nextMidPointQ);
841  trace.info() <<" Q - P Shrink returns the cone "<< *cone2<<" " <<*(cone2+1)<<std::endl;
842  trace.info() <<" Q - Pup Shrink returns the cone "<< *cone3<<" " <<*(cone3+1)<<std::endl;
843  trace.info() <<" Q - MidPoint "<< midPointQ<<" " <<nextMidPointQ<<std::endl<<std::endl;
844  nbok += ( cone2 == itBeg ) ? 1 : 0;
845  nb++;
846  trace.info() << "(" << nbok << "/" << nb << ") "
847  << " P's cone returns itBegin" << std::endl;
848 
849  trace.endBlock();
850 
851  Point PP(10,5);
852  Point QQ(3,4);
853  Point QQup(3,8);
854 
855  Metric::Abscissa pos = mask5711.getLowerVoronoiEdgeAbscissa(PP, QQ, Lmin, Lmax, 1);
856  trace.warning() <<" Abscissa of voro call (PP,QQ) = "<< pos <<std::endl;
857  nbok += ( pos < 5 ) ? 1 : 0;
858  nb++;
859  trace.info() << "(" << nbok << "/" << nb << ") "
860  << " PP-QQ cell is lesser than 5" << std::endl;
861 
862 
863  Metric::Abscissa pos2 = mask5711.getLowerVoronoiEdgeAbscissa(PP, QQup, Lmin, Lmax, 1);
864  trace.warning() <<" Abscissa of voro call (PP,QQup) = "<< pos2 <<std::endl;
865  nbok += ( pos2 > 5 ) ? 1 : 0;
866  nb++;
867  trace.info() << "(" << nbok << "/" << nb << ") "
868  << " PP-QQ cell is greater than 5" << std::endl;
869 
870 
871  Metric::ConstIterator conebis = mask5711.shrinkP(itBeg, itEnd, P, Pb, Lmin, Lmax, 1, midPointP, nextMidPointP);
872  Metric::Abscissa posbis = mask5711.getLowerVoronoiEdgeAbscissa(P, Pb, Lmin, Lmax, 1);
873  trace.info() <<" Pbis - Shrink returns the cone "<< *conebis<<" " <<*(conebis+1)<<std::endl;
874  trace.info() <<" Pbis - Shrink returns the cone "<< *conebis<<" " <<*(conebis+1)<<std::endl;
875  trace.info() <<" Pbis - Pos "<< posbis<<std::endl;
876 
877 
878  return nbok == nb;
879 }
880 
881 
883 {
884  unsigned int nbok = 0;
885  unsigned int nb = 0;
886 
887  //5-7-11 metic
889  Metric::Directions dirs5711;
890  Metric::Directions normals5711;
891  //5-7-11 mask
892  dirs5711.push_back(Z2i::Vector(0,-1));
893  dirs5711.push_back(Z2i::Vector(1,-2));
894  dirs5711.push_back(Z2i::Vector(1,-1));
895  dirs5711.push_back(Z2i::Vector(2,-1));
896  dirs5711.push_back(Z2i::Vector(1,0));
897  dirs5711.push_back(Z2i::Vector(2,1));
898  dirs5711.push_back(Z2i::Vector(1,1));
899  dirs5711.push_back(Z2i::Vector(1,2));
900 
901  normals5711.push_back(Z2i::Vector(1,-5));
902  normals5711.push_back(Z2i::Vector(3,-4));
903  normals5711.push_back(Z2i::Vector(4,-3));
904  normals5711.push_back(Z2i::Vector(5,-1));
905  normals5711.push_back(Z2i::Vector(5,1));
906  normals5711.push_back(Z2i::Vector(4,3));
907  normals5711.push_back(Z2i::Vector(3,4));
908  normals5711.push_back(Z2i::Vector(1,5));
909 
910  Metric mask5711(dirs5711,normals5711);
911 
912  trace.beginBlock ( "Testing special cases...");
913  //Setting:
914  Point U(12,-12);
915  Point V(6,0);
916  Point W(-16,3);
917  Point Lmin(11,-20);
918  Point Lmax(11,20);
919  Point midPointP,nextMidPointP;
920  Point midPointQ,nextMidPointQ;
921 
922  Metric::ConstIterator itBeg = mask5711.begin();
923  Metric::ConstIterator itEnd = mask5711.end();
924 
925 
926  Metric::ConstIterator cone2 = mask5711.shrinkP(itBeg, itEnd, V, W, Lmin, Lmax, 1, midPointQ, nextMidPointQ);
927  Metric::ConstIterator cone3 = mask5711.shrinkP(itBeg, itEnd, W, V, Lmin, Lmax, 1, midPointQ, nextMidPointQ);
928 
929  trace.info() <<" V - W Shrink returns the cone "<< *cone2<<" " <<*(cone2+1)<<std::endl;
930  trace.info() <<" W - V Shrink returns the cone "<< *cone3<<" " <<*(cone3+1)<<std::endl;
931  trace.info() <<" Q - MidPoint "<< midPointQ<<" " <<nextMidPointQ<<std::endl<<std::endl;
932 
933  Metric::Abscissa pos = mask5711.getLowerVoronoiEdgeAbscissa(V, W, Lmin, Lmax, 1);
934  trace.info() << " Pos = "<<pos<<std::endl;
935 
936 
937 
938  nbok += ( mask5711.hiddenBy(U,V, W, Lmin, Lmax, 1) == false ) ? 1 : 0;
939  nb++;
940  trace.info() << "(" << nbok << "/" << nb << ") "
941  << " H(U,V,W) is false" << std::endl;
942 
943 
944 
945  return nbok == nb;
946 
947 
948 
949 }
950 
952 // Standard services - public :
953 
954 int main( int argc, char** argv )
955 {
956  trace.beginBlock ( "Testing class ChamferDT" );
957  trace.info() << "Args:";
958  for ( int i = 0; i < argc; ++i )
959  trace.info() << " " << argv[ i ];
960  trace.info() << std::endl;
961 
963  && testShrink()
964  && testDoubleShrink()
966  && testHiddenBy()
968  && testSpecialCase(); // && ... other tests
969  trace.emphase() << ( res ? "Passed." : "Error." ) << std::endl;
970  trace.endBlock();
971  return res ? 0 : 1;
972 }
973 // //
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
std::ostream & warning()
double endBlock()
Aim: implements a model of CSeparableMetric for Chamfer and path based norms.
Definition: ChamferNorm2D.h:87
Vector getNormalFromCone(ConstIterator aCone) const
Vector canonicalRay(const Vector &aRay) const
ConstIterator getCone(const Vector &aDirection, ConstIterator aBegin, ConstIterator aEnd) const
std::vector< Vector > Directions
Container for set of directions.
DigitalPlane::Point Vector
MyDigitalSurface::ConstIterator ConstIterator
Space::Point Point
Definition: StdDefs.h:95
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:153
Aim: defines the concept of metric spaces.
Definition: CMetricSpace.h:125
Aim: defines the concept of separable metrics.
bool testDoubleOnSegment()
bool testDoubleShrinkHorizontal()
bool testDoubleShrink()
int main(int argc, char **argv)
bool testIntersection()
bool testShrink()
bool testBasicMasks()
bool testHiddenBy()
bool testChamferSimple()
bool checkCMetricConcept()
bool testSpecialCase()