GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
area_poly2.c
Go to the documentation of this file.
1
17
#include <grass/gis.h>
18
19
29
double
G_planimetric_polygon_area
(
const
double
*x,
const
double
*
y
,
int
n)
30
{
31
double
x1, y1, x2, y2;
32
double
area;
33
34
x2 = x[n - 1];
35
y2 = y[n - 1];
36
37
area = 0;
38
while
(--n >= 0) {
39
x1 = x2;
40
y1 = y2;
41
42
x2 = *x++;
43
y2 = *y++;
44
45
area += (y2 + y1) * (x2 - x1);
46
}
47
48
if
((area /= 2.0) < 0.0)
49
area = -area;
50
51
return
area;
52
}
lib
gis
area_poly2.c
Generated on Thu Sep 26 2013 09:47:58 for GRASS Programmer's Manual by
1.8.4