#include <CGAL/all_furthest_neighbors_2.h>
computes all furthest neighbors for the vertices of the convex polygon described by the range [points_begin, points_end), writes their indices (relative to points_begin) to o1 and returns the past-the-end iterator of this sequence.
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
#include <CGAL/all_furthest_neighbors_2.h>
#include <CGAL/IO/Ostream_iterator.h>
#include <iostream>
#include <vector>
using namespace std;
using CGAL::random_convex_set_2;
using CGAL::all_furthest_neighbors;
typedef double FT;
typedef CGAL::Cartesian< FT > R;
typedef CGAL::Point_2< R > Point;
typedef CGAL::Polygon_traits_2< R > P_traits;
typedef vector< Point > Point_cont;
typedef CGAL::Polygon_2< P_traits, Point_cont > Polygon;
typedef CGAL::Creator_uniform_2< FT, Point > Creator;
typedef CGAL::Random_points_in_square_2< Point, Creator >
Point_generator;
typedef CGAL::Ostream_iterator< int, ostream > Oiterator;
int
main()
{
// generate random convex polygon:
Polygon p;
random_convex_set_2( 10, back_inserter( p), Point_generator( 1));
// compute all furthest neighbors:
all_furthest_neighbors(
p.vertices_begin(),
p.vertices_end(),
Oiterator( cout));
cout << endl;
return 0;
}
| 1 | i.e. the furthest neighbor of points_begin[i] is points_begin[-th number written to o] |