]> Pileus Git - grits/blobdiff - src/grits-util.h
Add cube GtkGL example
[grits] / src / grits-util.h
index ccc75585ad702a7b9f9730e189dc87a5c84c2da5..9a22ab519e06c08163d63c89944269500332cd66 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
+ * Copyright (C) 2009-2011 Andy Spencer <andy753421@gmail.com>
  *
  * 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
@@ -15,8 +15,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __GIS_UTIL_H__
-#define __GIS_UTIL_H__
+#ifndef __GRITS_UTIL_H__
+#define __GRITS_UTIL_H__
 
 #include <glib.h>
 
  * Datatypes *
  *************/
 
-/* GisPoint */
-typedef struct _GisPoint GisPoint;
-struct _GisPoint {
+/* GritsPoint */
+typedef struct _GritsPoint GritsPoint;
+struct _GritsPoint {
        gdouble lat, lon, elev;
 };
 
-void gis_point_set_lle(GisPoint *point,
+void grits_point_set_lle(GritsPoint *point,
                gdouble lat, gdouble lon, gdouble elev);
 
-/* GisBounds */
-typedef struct _GisBounds GisBounds;
-struct _GisBounds {
+/* GritsPoints */
+typedef gdouble (*GritsPoints)[3];
+
+/* GritsBounds */
+typedef struct _GritsBounds GritsBounds;
+struct _GritsBounds {
        gdouble n, s, e, w;
 };
 
-void gis_bounds_set_bounds(GisBounds *bounds,
+void grits_bounds_set_bounds(GritsBounds *bounds,
                gdouble n, gdouble s, gdouble e, gdouble w);
 
 
@@ -175,9 +178,9 @@ void gis_bounds_set_bounds(GisBounds *bounds,
 /**
  * FOV_DIST:
  *
- * Used by GisOpenGL to set up the drawing window
+ * Used by GritsOpenGL to set up the drawing window
  */
-#define FOV_DIST   2000.0
+#define FOV_DIST   (1039.23)
 
 /**
  * MPPX:
@@ -187,7 +190,7 @@ void gis_bounds_set_bounds(GisBounds *bounds,
  *
  * Returns: the resolution in meters per pixel
  */
-#define MPPX(dist) (4*dist/FOV_DIST)
+#define MPPX(dist) (dist/FOV_DIST)
 
 void lle2xyz(gdouble lat, gdouble lon, gdouble elev,
                gdouble *x, gdouble *y, gdouble *z);
@@ -202,6 +205,20 @@ gdouble ll2m(gdouble lon_dist, gdouble lat);
 
 gdouble distd(gdouble *a, gdouble *b);
 
+void crossd(gdouble *a, gdouble *b, gdouble *out);
+
+void crossd3(gdouble *a, gdouble *b, gdouble *c, gdouble *out);
+
+gdouble lengthd(gdouble *a);
+
+void normd(gdouble *a);
+
 gdouble lon_avg(gdouble a, gdouble b);
 
+GritsPoints *parse_points(const gchar *string,
+               const gchar *group_sep, const gchar *point_sep, const gchar *coord_sep,
+               GritsBounds *bounds, GritsPoint *center);
+
+void free_points(GritsPoints *points);
+
 #endif