1 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
2 #include <CGAL/Delaunay_triangulation_2.h>
4 #include <CGAL/Interpolation_traits_2.h>
5 #include <CGAL/natural_neighbor_coordinates_2.h>
6 #include <CGAL/interpolation_functions.h>
8 typedef CGAL::Exact_predicates_inexact_constructions_kernel
K;
10 typedef CGAL::Interpolation_traits_2<K>
Traits;
17 std::map<Point, Coord_type, K::Less_xy_2> function_values;
18 typedef CGAL::Data_access< std::map<Point, Coord_type, K::Less_xy_2 > >
23 for (
int y=0 ;
y<3 ;
y++)
24 for (
int x=0 ;
x<3 ;
x++){
27 function_values.insert(std::make_pair(p,
a + bx*
x+ by*
y));
30 K::Point_2
p(1.3,0.34);
31 std::vector< std::pair< Point, Coord_type > >
coords;
33 CGAL::natural_neighbor_coordinates_2
34 (T, p,std::back_inserter(coords)).second;
36 Coord_type res = CGAL::linear_interpolation(coords.begin(), coords.end(),
38 Value_access(function_values));
40 std::cout <<
" Tested interpolation on " << p <<
" interpolation: "
41 << res <<
" exact: " <<
a + bx* p.x()+ by* p.y()<< std::endl;
43 std::cout <<
"done" << std::endl;
CGAL::Exact_predicates_inexact_constructions_kernel K
CGAL::Delaunay_triangulation_2< K > Delaunay_triangulation
CGAL::Interpolation_traits_2< K > Traits