GRASS GIS 7 Programmer's Manual  7.0.5(2016)-r00000
area_sphere.c
Go to the documentation of this file.
1 
14 #include <math.h>
15 #include <grass/gis.h>
16 #include "pi.h"
17 
18 
19 static struct state {
20  double M;
21 } state;
22 
23 static struct state *st = &state;
24 
36 void G_begin_zone_area_on_sphere(double r, double s)
37 {
38  st->M = s * 2.0 * r * r * M_PI;
39 }
40 
48 double G_darea0_on_sphere(double lat)
49 {
50  return (st->M * sin(Radians(lat)));
51 }
52 
70 double G_area_for_zone_on_sphere(double north, double south)
71 {
72  return (G_darea0_on_sphere(north) - G_darea0_on_sphere(south));
73 }
double G_darea0_on_sphere(double lat)
Calculates integral for area between two latitudes.
Definition: area_sphere.c:48
struct state * st
Definition: parser.c:101
void G_begin_zone_area_on_sphere(double r, double s)
Initialize calculations for sphere.
Definition: area_sphere.c:36
#define Radians(x)
Definition: pi.h:6
double G_area_for_zone_on_sphere(double north, double south)
Calculates area between latitudes.
Definition: area_sphere.c:70
double r
struct state state
Definition: parser.c:100