X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Fgis-util.c;h=f748cd2e280675a7170d143972f1ccbb3c277532;hb=07cebdd8475eeaf5f9cd155ff0424e937aa5c6d8;hp=587dd5c10d26e3418a1d80b0ef6c282d37117011;hpb=6cbd796209e724ddff668447337069539498c243;p=grits diff --git a/src/gis-util.c b/src/gis-util.c index 587dd5c..f748cd2 100644 --- a/src/gis-util.c +++ b/src/gis-util.c @@ -73,6 +73,48 @@ #include "gis-util.h" +/************ + * GisPoint * + ************/ +/** + * gis_point_set_lle: + * @point: the point to modify + * @lat: the new latitude + * @lon: the new longitude + * @elev: the new elevation + * + * Set the latitude, longitude, and elevation for a point. + */ +void gis_point_set_lle(GisPoint *point, gdouble lat, gdouble lon, gdouble elev) +{ + point->lat = lat; + point->lon = lon; + point->elev = elev; +} + + +/*********** + * GisBBox * + ***********/ +/** + * gis_bbox_set_bounds: + * @n: the north edge + * @s: the south edge + * @e: the east edge + * @w: the west edge + * + * Set the north, south, east, and west edges of the bounding box + */ +void gis_bbox_set_bounds(GisBBox *bbox, + gdouble n, gdouble s, gdouble e, gdouble w) +{ + bbox->n = n; + bbox->s = s; + bbox->e = e; + bbox->w = w; +} + + /****************** * Global helpers * ******************/ @@ -149,9 +191,9 @@ void xyz2ll(gdouble x, gdouble y, gdouble z, */ gdouble ll2m(gdouble lon_dist, gdouble lat) { - gdouble azim = (-lat+90)/180*M_PI; - gdouble rad = sin(azim) * EARTH_R; - gdouble circ = 2 * M_PI * rad; + gdouble incl = lat2incl(lat); + gdouble rad = sin(incl) * EARTH_R; + gdouble circ = 2 * G_PI * rad; return lon_dist/360 * circ; }