GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
area_sphere.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 M;
23 
24 
25 /*
26  * r is radius of sphere, s is a scaling factor
27  */
28 
42 int G_begin_zone_area_on_sphere(double r, double s)
43 {
44  return (M = s * 2.0 * r * r * M_PI);
45 }
46 
47 
55 double G_darea0_on_sphere(double lat)
56 {
57  return (M * sin(Radians(lat)));
58 }
59 
60 
78 double G_area_for_zone_on_sphere(double north, double south)
79 {
80  return (G_darea0_on_sphere(north) - G_darea0_on_sphere(south));
81 }
double G_darea0_on_sphere(double lat)
Calculates integral for area between two latitudes.
Definition: area_sphere.c:55
int G_begin_zone_area_on_sphere(double r, double s)
Initialize calculations for sphere.
Definition: area_sphere.c:42
float r
Definition: named_colr.c:8
#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:78