2
/* conversion routines to convert from view x,y to cell col,row
3
* as well as cell col,row to cell east,north
5
int view_to_col(View * view, int x)
7
return x - view->cell.left;
10
int view_to_row(View * view, int y)
12
return y - view->cell.top;
15
int col_to_view(View * view, int col)
17
return view->cell.left + col;
20
int row_to_view(View * view, int row)
22
return view->cell.top + row;
25
/* in these next 2 routines, location determines if we are
26
* converting from center of the cell (location == .5)
27
* top or left edge (location == 0.0)
28
* bottom or right edge (location == 1.0)
31
double row_to_northing(struct Cell_head *cellhd, int row, double location)
33
return cellhd->north - (row + location) * cellhd->ns_res;
36
double col_to_easting(struct Cell_head *cellhd, int col, double location)
38
return cellhd->west + (col + location) * cellhd->ew_res;
41
double northing_to_row(struct Cell_head *cellhd, double north)
43
return (cellhd->north - north) / cellhd->ns_res;
46
double easting_to_col(struct Cell_head *cellhd, double east)
48
return (east - cellhd->west) / cellhd->ew_res;