Subject: CGAL users discussion list
List archive
- From: Adam Laža <>
- To:
- Subject: [cgal-discuss] CGAL::linear_interpolation
- Date: Thu, 21 May 2015 18:37:52 +0200
Adam
Code:
/* perform NN interpolation */
G_message(_("Computing..."));
/* triangulation */
Delaunay_triangulation T;
typedef CGAL::Data_access< std::map<Point, Coord_type, K::Less_xy_2 > >
Value_access;
T.insert(points.begin(), points.end());
//coordinate computation in grid
double coor_x, coor_y;
coor_x = window.west;
coor_y = window.north;
G_percent(rows, window.rows, 2);
if (mask)
Rast_get_c_row(maskfd, mask, rows);
coor_x = window.west;
for (int cols=0 ; cols<window.cols ; cols++) {
/* don't interpolate outside of the mask */
if (mask && mask[cols] == 0) {
Rast_set_d_null_value(&dcell[cols], 1);
continue;
}
K::Point_2 p(coor_x,coor_y);
std::vector< std::pair< Point, Coord_type > > coords;
Coord_type norm = CGAL::natural_neighbor_coordinates_2(T, p,std::back_inserter(coords)).second;
Coord_type res = CGAL::linear_interpolation(coords.begin(), coords.end(), norm, Value_access(function_values));
G_debug(5, "x: %f y: %f -> res: %f (row=%d; col=%d)",
coor_x, coor_y, res, rows, cols);
coor_x += ewres;
//std::cout << res << " ";
dcell[cols] = (DCELL) res;
}
coor_y -= nsres;
//std::cout << std::endl;
Rast_put_d_row(fd, dcell);
}
G_percent(1, 1, 1);
- [cgal-discuss] CGAL::linear_interpolation, Adam Laža, 05/21/2015
- Re: [cgal-discuss] CGAL::linear_interpolation, Sebastien Loriot (GeometryFactory), 05/22/2015
- Re: [cgal-discuss] CGAL::linear_interpolation, Adam Laža, 05/24/2015
- Re: [cgal-discuss] CGAL::linear_interpolation, Andreas Fabri, 05/28/2015
- Re: [cgal-discuss] CGAL::linear_interpolation, Sebastien Loriot (GeometryFactory), 05/22/2015
Archive powered by MHonArc 2.6.18.