131 using namespace functions::Hull2D;
140 vector<Z2i::Point> res;
144 StrictPredicate predicate( functor );
150 andrewConvexHullAlgorithm( pointSet.
begin(), pointSet.
end(), back_inserter( res ), predicate );
157 Z2i::Point antipodalP, antipodalQ, antipodalS;
162 trace.
info() <<
" ConvexHull HV thickness: " << th << std::endl;
168 board.
drawCircle( antipodalS[0], antipodalS[1], 0.2) ;
170 board.
drawCircle(antipodalP[0], antipodalP[1], 0.2);
171 board.
drawCircle(antipodalQ[0], antipodalQ[1], 0.2);
172 board.
drawLine(antipodalP[0], antipodalP[1], antipodalQ[0], antipodalQ[1]);
175 board.
saveSVG(
"ConvexHullCCW.svg" );
177 board.
saveCairo(
"ConvexHullCCW.png", Board2D::CairoPNG);
182 vector<Z2i::Point> res;
186 LargePredicate predicate( functor );
192 andrewConvexHullAlgorithm( pointSet.
begin(), pointSet.
end(), back_inserter( res ), predicate );
197 board.
saveSVG(
"ConvexHullCCWWithPointsOnEdges.svg" );
199 board.
saveCairo(
"ConvexHullCCWWithPointsOnEdges.png", Board2D::CairoPNG);
205 vector<Z2i::Point> res;
209 StrictPredicate predicate( functor );
215 andrewConvexHullAlgorithm( pointSet.
begin(), pointSet.
end(), back_inserter( res ), predicate );
220 board.
saveSVG(
"ConvexHullCW.svg" );
222 board.
saveCairo(
"ConvexHullCW.png", Board2D::CairoPNG);
227 vector<Z2i::Point> res;
231 StrictPredicate predicate( functor );
234 grahamConvexHullAlgorithm( pointSet.
begin(), pointSet.
end(), back_inserter( res ), predicate );
240 board.
saveSVG(
"ConvexHullCCWbis.svg" );
242 board.
saveCairo(
"ConvexHullCCWbis.png", Board2D::CairoPNG);
247 vector<Z2i::Point> polygonalLine;
258 vector<Z2i::Point> resGraham, res;
261 StrictPredicate predicate( functor );
262 closedGrahamScanFromAnyPoint( polygonalLine.begin(), polygonalLine.end(), back_inserter( resGraham ), predicate );
266 for (std::vector<Z2i::Point>::const_iterator
267 it = polygonalLine.begin(),
268 itEnd = polygonalLine.end();
274 melkmanConvexHullAlgorithm( polygonalLine.begin(), polygonalLine.end(), back_inserter( res ), functor );
279 drawPolygon( polygonalLine.begin(), polygonalLine.end(), board,
true );
280 board.
saveSVG(
"SimplePolygonalLine.svg" );
282 board.
saveCairo(
"SimplePolygonalLine.png", Board2D::CairoPNG);
285 drawPolygon( resGraham.begin(), resGraham.end(), board );
286 board.
saveSVG(
"SimplePolygonalLineGraham.svg" );
288 board.
saveCairo(
"SimplePolygonalLineGraham.png", Board2D::CairoPNG);
292 board.
saveSVG(
"SimplePolygonalLineMelkman.svg" );
294 board.
saveCairo(
"SimplePolygonalLineMelkman.png", Board2D::CairoPNG);
298 board.
saveSVG(
"SimplePolygonalLineMelkman2.svg" );
300 board.
saveCairo(
"SimplePolygonalLineMelkman2.png", Board2D::CairoPNG);
305 vector<Z2i::Point> res;
306 std::copy( pointSet.
begin(), pointSet.
end(), back_inserter( res ) );
308 std::sort( res.begin(), res.end() );
312 drawPolygon( res.begin(), res.end(), board,
false );
313 board.
saveSVG(
"AndrewWEVP.svg" );
315 board.
saveCairo(
"AndrewWEVP.png", Board2D::CairoPNG);
320 vector<Z2i::Point> res;
321 std::copy( pointSet.
begin(), pointSet.
end(), back_inserter( res ) );
327 std::vector<Z2i::Point>::iterator itMax
328 = std::max_element( res.begin(), res.end() );
333 std::sort( res.begin(), res.end(), comparator );
337 drawPolygon( res.begin(), res.end(), board,
false );
338 board.
saveSVG(
"GrahamWEVP.svg" );
340 board.
saveCairo(
"GrahamWEVP.png", Board2D::CairoPNG);