~ubuntu-branches/ubuntu/precise/grass/precise

« back to all changes in this revision

Viewing changes to imagery/i.ortho.photo/photo.2target/conv.c

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-04-13 17:08:41 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110413170841-ss1t9bic0d0uq0gz
Tags: 6.4.1-1
* New upstream version.
* Now build-dep on libjpeg-dev and current libreadline6-dev.
* Removed patch swig: obsolete.
* Policy bumped to 3.9.2, without changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "globals.h"
2
 
/* conversion routines to convert from view x,y to cell col,row
3
 
 * as well as cell col,row to cell east,north
4
 
 */
5
 
int view_to_col(View * view, int x)
6
 
{
7
 
    return x - view->cell.left;
8
 
}
9
 
 
10
 
int view_to_row(View * view, int y)
11
 
{
12
 
    return y - view->cell.top;
13
 
}
14
 
 
15
 
int col_to_view(View * view, int col)
16
 
{
17
 
    return view->cell.left + col;
18
 
}
19
 
 
20
 
int row_to_view(View * view, int row)
21
 
{
22
 
    return view->cell.top + row;
23
 
}
24
 
 
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)
29
 
 */
30
 
 
31
 
double row_to_northing(struct Cell_head *cellhd, int row, double location)
32
 
{
33
 
    return cellhd->north - (row + location) * cellhd->ns_res;
34
 
}
35
 
 
36
 
double col_to_easting(struct Cell_head *cellhd, int col, double location)
37
 
{
38
 
    return cellhd->west + (col + location) * cellhd->ew_res;
39
 
}
40
 
 
41
 
double northing_to_row(struct Cell_head *cellhd, double north)
42
 
{
43
 
    return (cellhd->north - north) / cellhd->ns_res;
44
 
}
45
 
 
46
 
double easting_to_col(struct Cell_head *cellhd, double east)
47
 
{
48
 
    return (east - cellhd->west) / cellhd->ew_res;
49
 
}