84 unsigned int nbok = 0;
89 Z2i::Point a( 0,0), b(5, 0), bb(5,-10), bbb(5,5),c(10,0), d(3,3);
95 AdaptedDistance metric(l2);
104 trace.
info() <<
"distance between a and bb = "<< metric(a,bb)<< std::endl;
110 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
111 <<
"closest(a,d,c) returns d" << std::endl;
113 bool hidden =metric.hiddenBy(a,b,c,starting,endpoint,0);
114 nbok += (!hidden) ? 1 : 0;
116 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
117 <<
"(a,b,c) returns false" << std::endl;
119 hidden =metric.hiddenBy(a,bb,c,starting,endpoint,0);
120 nbok += (hidden) ? 1 : 0;
122 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
123 <<
"(a,bb,c) returns true" << std::endl;
125 hidden =metric.hiddenBy(a,bbb,c,starting,endpoint,0);
126 nbok += (!hidden) ? 1 : 0;
128 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
129 <<
"(a,bbb,c) returns false" << std::endl;
139 AdaptedDistance3 metric3(l3);
148 hidden =metric3.hiddenBy(a,b,c,starting,endpoint,0);
149 nbok += (!hidden) ? 1 : 0;
151 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
152 <<
"(a,b,c) returns false" << std::endl;
154 hidden =metric3.hiddenBy(a,bb,c,starting,endpoint,0);
155 nbok += (hidden) ? 1 : 0;
157 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
158 <<
"(a,bb,c) returns true" << std::endl;
160 hidden =metric3.hiddenBy(a,bbb,c,starting,endpoint,0);
161 nbok += (!hidden) ? 1 : 0;
163 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
164 <<
"(a,bbb,c) returns false" << std::endl;
175 Adapted adapted(aMetric);
177 unsigned int nbok = 0;
203 VoroExact voroExact(
domain, mySet,aMetric);
204 VoroAdapted voroAdapted(
domain, mySet, adapted);
207 trace.
info()<<
"Exporting o SVG"<<std::endl;
209 for(
typename VoroExact::OutputImage::Domain::ConstIterator it = voroExact.domain().begin(),
210 itend = voroExact.domain().end();
214 unsigned char c = (p[1]*13 + p[0] * 7) % 256;
218 string out = filename +
"-exact.svg";
222 for(
typename VoroAdapted::OutputImage::Domain::ConstIterator it = voroAdapted.domain().begin(),
223 itend = voroAdapted.domain().end();
227 unsigned char c = (p[1]*13 + p[0] * 7) % 256;
231 out = filename +
"-adapted.svg";
236 for(
typename VoroExact::OutputImage::Domain::ConstIterator it = voroExact.domain().begin(),
237 itend = voroExact.domain().end();
240 if (voroExact(*it) != voroAdapted(*it))
243 nbok +=
true ? 1 : 0;
245 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
246 <<
"Voronoi diagram is valid !" << std::endl;
Iterator for HyperRectDomain.
const ConstIterator & begin() const
const ConstIterator & end() const