UNITS_TEXT[UNITS_NM] = _("n.m.");
}
+gfloat
+angle_diff(gfloat a, gfloat b)
+{
+gfloat tmax, tmin, t;
+
+tmax=MAX(a,b);
+tmin=MIN(a,b);
+
+t=tmax-tmin;
+if (t>180) t-=360;
+
+return t;
+}
+
static inline gdouble
magnitude(gdouble x1, gdouble y1, gdouble x2, gdouble y2)
{
switch (degformat) {
case DDPDDDDD:
g_sprintf(scoor, "%.5f°", coor);
- break;
+ break;
case DDPDDDDD_NSEW:
- g_sprintf(scoor, "%.5f° %c", acoor,
- coor < 0.f ? neg_char : pos_char);
- break;
-
+ g_sprintf(scoor, "%.5f° %c", acoor, coor < 0.f ? neg_char : pos_char);
+ break;
case DD_MMPMMM:
- g_sprintf(scoor, "%d°%06.3f'",
- (int)coor, (acoor - (int)acoor) * 60.0);
- break;
+ g_sprintf(scoor, "%d°%06.3f'", (int)coor, (acoor - (int)acoor) * 60.0);
+ break;
case DD_MMPMMM_NSEW:
- g_sprintf(scoor, "%d°%06.3f' %c",
- (int)acoor, (acoor - (int)acoor) * 60.0,
- coor < 0.f ? neg_char : pos_char);
- break;
-
+ g_sprintf(scoor, "%d°%06.3f' %c", (int)acoor, (acoor - (int)acoor) * 60.0, coor < 0.f ? neg_char : pos_char);
+ break;
case DD_MM_SSPS:
min = (acoor - (int)acoor) * 60.0;
- g_sprintf(scoor, "%d°%02d'%04.1f\"", (int)coor, (int)min,
- ((min - (int)min) * 60.0));
- break;
+ g_sprintf(scoor, "%d°%02d'%04.1f\"", (int)coor, (int)min, ((min - (int)min) * 60.0));
+ break;
case DD_MM_SSPS_NSEW:
min = (acoor - (int)acoor) * 60.0;
- g_sprintf(scoor, "%d°%02d'%04.1f\" %c", (int)acoor, (int)min,
- ((min - (int)min) * 60.0),
- coor < 0.f ? neg_char : pos_char);
- break;
- default:;
+ g_sprintf(scoor, "%d°%02d'%04.1f\" %c", (int)acoor, (int)min, ((min - (int)min) * 60.0), coor < 0.f ? neg_char : pos_char);
+ break;
+ default:
+ g_return_if_reached();
+ break;
}
}
gint32 lon2mp_int(gdouble lon);
gint32 lat2mp_int(gdouble lat);
+
gdouble calculate_distance(gdouble lat1, gdouble lon1, gdouble lat2, gdouble lon2);
gdouble calculate_ddistance(gint lat1, gint lon1, gint lat2, gint lon2);
gulong calculate_idistance(gint lat1, gint lon1, gint lat2, gint lon2);
gulong calculate_idistance_cmp(gint lat1, gint lon1, gint lat2, gint lon2);
+
gdouble calculate_course_rad(gdouble lat1, gdouble lon1, gdouble lat2, gdouble lon2);
gdouble calculate_course(gdouble lat1, gdouble lon1, gdouble lat2, gdouble lon2);
+gfloat angle_diff(gfloat a, gfloat b);
+
gboolean distance_point_to_line(gdouble x, gdouble y, gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble *d);
guint32 xy2tile(guint x, guint y);