GRASS Programmer's Manual  6.5.svn(2014)-r66266
area_ellipse.c
Go to the documentation of this file.
1
17 #include <math.h>
18 #include <grass/gis.h>
19 #include "pi.h"
20
21
22 static double E;
23 static double M;
24
25
26 /*
27  * a is semi-major axis, e2 is eccentricity squared, s is a scale factor
28  * code will fail if e2==0 (sphere)
29  */
30
50 int G_begin_zone_area_on_ellipsoid(double a, double e2, double s)
51 {
52  E = sqrt(e2);
53  M = s * a * a * M_PI * (1 - e2) / E;
54
55  return 0;
56 }
57
58
69 double G_darea0_on_ellipsoid(double lat)
70 {
71  double x;
72
73  x = E * sin(Radians(lat));
74
75  return (M * (x / (1.0 - x * x) + 0.5 * log((1.0 + x) / (1.0 - x))));
76 }
77
78
96 double G_area_for_zone_on_ellipsoid(double north, double south)
97 {
98  return (G_darea0_on_ellipsoid(north) - G_darea0_on_ellipsoid(south));
99 }
double G_area_for_zone_on_ellipsoid(double north, double south)
Calculates area between latitudes.
Definition: area_ellipse.c:96
double G_darea0_on_ellipsoid(double lat)
Calculate integral for area between two latitudes.
Definition: area_ellipse.c:69
log
Definition: wxnviz.py:54
int G_begin_zone_area_on_ellipsoid(double a, double e2, double s)
Begin area calculations for ellipsoid.
Definition: area_ellipse.c:50