X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Fgis-util.h;h=3bc4d660013eb20a93faae07b5ae5825fb987e04;hb=3812f4ecfc3894f0118ec6eb173a0cc705ec2ceb;hp=a9f288a35b85f2554813355d6abfdeb770d65737;hpb=921d317225e75527d6f1d9fdc96b2fd1fb3f6840;p=grits diff --git a/src/gis-util.h b/src/gis-util.h index a9f288a..3bc4d66 100644 --- a/src/gis-util.h +++ b/src/gis-util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Andy Spencer + * Copyright (C) 2009-2010 Andy Spencer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,8 +18,10 @@ #ifndef __GIS_UTIL_H__ #define __GIS_UTIL_H__ +#include + #define EARTH_R (6371000) -#define EARTH_C (2*M_PI*EARTH_R) +#define EARTH_C (2*G_PI*EARTH_R) #define NORTH 90 #define SOUTH -90 #define EAST 180 @@ -65,15 +67,15 @@ * xyz2lle: 0.0, 0.0, 10.0 -> 0.0, 0.0, 0.0 */ -#define azim2lon(azim) ((azim)*180/M_PI) -#define lon2azim(lon) ((lon)*M_PI/180) -#define incl2lat(incl) (90-(incl)*180/M_PI) -#define lat2incl(lat) ((90-(lat))*M_PI/180) +#define azim2lon(azim) ((azim)*180/G_PI) +#define lon2azim(lon) ((lon)*G_PI/180) +#define incl2lat(incl) (90-(incl)*180/G_PI) +#define lat2incl(lat) ((90-(lat))*G_PI/180) #define rad2elev(rad) ((rad)-EARTH_R) #define elev2rad(elev) ((elev)+EARTH_R) -#define deg2rad(deg) (((deg)*M_PI)/180.0) -#define rad2deg(rad) (((rad)*180.0)/M_PI) +#define deg2rad(deg) (((deg)*G_PI)/180.0) +#define rad2deg(rad) (((rad)*180.0)/G_PI) #define FOV_DIST 2000.0 #define MPPX(dist) (4*dist/FOV_DIST) @@ -91,4 +93,6 @@ gdouble ll2m(gdouble lon_dist, gdouble lat); gdouble distd(gdouble *a, gdouble *b); +gdouble lon_avg(gdouble a, gdouble b); + #endif