summaryrefslogtreecommitdiff
path: root/navit/coord.h
diff options
context:
space:
mode:
authorsteven_s <steven_s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-03-21 17:34:10 +0000
committersteven_s <steven_s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-03-21 17:34:10 +0000
commitb379b21d8a616db863ec6eb1f0acc59150a7e721 (patch)
tree29a4797a6dcba0701e6b80b7238f259004c2f5c5 /navit/coord.h
parent2a82a41e381ac46781126fd41770bfcf01201c8d (diff)
downloadnavit-b379b21d8a616db863ec6eb1f0acc59150a7e721.tar.gz
Fix:transform:Use single precision vs double precision for lat/lng
calculates when AVOID_FLOAT is set. git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2157 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/coord.h')
-rw-r--r--navit/coord.h37
1 files changed, 32 insertions, 5 deletions
diff --git a/navit/coord.h b/navit/coord.h
index 615774f8a..d614d60fe 100644
--- a/navit/coord.h
+++ b/navit/coord.h
@@ -40,6 +40,33 @@ struct coord_rect {
struct coord rl;
};
+
+#ifdef AVOID_FLOAT
+/**
+ * On platforms where we are trying to avoid floats, sometimes we can't.
+ * It is better on these platforms to use single precision floating points
+ * over double percision ones since performance is much better.
+ */
+typedef float navit_float;
+#define navit_sin(x) sinf(x)
+#define navit_cos(x) cosf(x)
+#define navit_tan(x) tanf(x)
+#define navit_atan(x) atanf(x)
+#define navit_acos(x) acosf(x)
+#define navit_asin(x) asinf(x)
+#define navit_sqrt(x) sqrtf(x)
+#else
+typedef double navit_float;
+#define navit_sin(x) sin(x)
+#define navit_cos(x) cos(x)
+#define navit_tan(x) tan(x)
+#define navit_atan(x) atan(x)
+#define navit_acos(x) acos(x)
+#define navit_asin(x) asin(x)
+#define navit_sqrt(x) sqrt(x)
+#endif
+
+
//! A double mercator coordinate
struct coord_d {
double x; /*!< X-Value */
@@ -48,15 +75,15 @@ struct coord_d {
//! A WGS84 coordinate
struct coord_geo {
- double lng; /*!< Longitude */
- double lat; /*!< Latitude */
+ navit_float lng; /*!< Longitude */
+ navit_float lat; /*!< Latitude */
};
//! A cartesian coordinate
struct coord_geo_cart {
- double x; /*!< X-Value */
- double y; /*!< Y-Value */
- double z; /*!< Z-Value */
+ navit_float x; /*!< X-Value */
+ navit_float y; /*!< Y-Value */
+ navit_float z; /*!< Z-Value */
};
/**