• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

area_ellipse.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 E;
00023 static double M;
00024 
00025 
00026 /*
00027  * a is semi-major axis, e2 is eccentricity squared, s is a scale factor
00028  * code will fail if e2==0 (sphere)
00029  */
00030 
00050 int G_begin_zone_area_on_ellipsoid(double a, double e2, double s)
00051 {
00052     E = sqrt(e2);
00053     M = s * a * a * M_PI * (1 - e2) / E;
00054 
00055     return 0;
00056 }
00057 
00058 
00069 double G_darea0_on_ellipsoid(double lat)
00070 {
00071     double x;
00072 
00073     x = E * sin(Radians(lat));
00074 
00075     return (M * (x / (1.0 - x * x) + 0.5 * log((1.0 + x) / (1.0 - x))));
00076 }
00077 
00078 
00096 double G_area_for_zone_on_ellipsoid(double north, double south)
00097 {
00098     return (G_darea0_on_ellipsoid(north) - G_darea0_on_ellipsoid(south));
00099 }

Generated on Thu Dec 9 2010 20:46:04 for GRASS Programmer's Manual by  doxygen 1.7.2