GRASS Programmer's Manual  6.4.1(2011)
area_sphere.c
Go to the documentation of this file.
00001 
00017 #include <math.h>
00018 #include <grass/gis.h>
00019 #include "pi.h"
00020 
00021 
00022 static double M;
00023 
00024 
00025 /*
00026  * r is radius of sphere, s is a scaling factor
00027  */
00028 
00042 int G_begin_zone_area_on_sphere(double r, double s)
00043 {
00044     return (M = s * 2.0 * r * r * M_PI);
00045 }
00046 
00047 
00055 double G_darea0_on_sphere(double lat)
00056 {
00057     return (M * sin(Radians(lat)));
00058 }
00059 
00060 
00078 double G_area_for_zone_on_sphere(double north, double south)
00079 {
00080     return (G_darea0_on_sphere(north) - G_darea0_on_sphere(south));
00081 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines