]> Pileus Git - grits/blobdiff - src/gis-util.c
Rename GisBBox to GisBounds
[grits] / src / gis-util.c
index 587dd5c10d26e3418a1d80b0ef6c282d37117011..d42cee59d1a33c9c2b06e3950a49258ad0548b8c 100644 (file)
 
 #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;
+}
+
+
+/*************
+ * GisBounds *
+ *************/
+/**
+ * gis_bounds_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_bounds_set_bounds(GisBounds *bounds,
+               gdouble n, gdouble s, gdouble e, gdouble w)
+{
+       bounds->n = n;
+       bounds->s = s;
+       bounds->e = e;
+       bounds->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;
 }