longitude -= 360.0;
/* Now convert. */
- lat_rad = latitude * M_PI / 180.0;
- long_rad = longitude * M_PI / 180.0;
+ lat_rad = DEG2RAD(latitude);
+ long_rad = DEG2RAD(longitude);
zone = (int) ( ( longitude + 180 ) / 6 ) + 1;
if ( latitude >= 56.0 && latitude < 64.0 &&
longitude >= 3.0 && longitude < 12.0 )
else if ( longitude >= 33.0 && longitude < 42.0 ) zone = 37;
}
long_origin = ( zone - 1 ) * 6 - 180 + 3; /* +3 puts origin in middle of zone */
- long_origin_rad = long_origin * M_PI / 180.0;
+ long_origin_rad = DEG2RAD(long_origin);
eccPrimeSquared = EccentricitySquared / ( 1.0 - EccentricitySquared );
N = EquatorialRadius / sqrt( 1.0 - EccentricitySquared * sin( lat_rad ) * sin( lat_rad ) );
T = tan( lat_rad ) * tan( lat_rad );
R1 = EquatorialRadius * ( 1.0 - EccentricitySquared ) / pow( 1.0 - EccentricitySquared * sin( phi1_rad ) * sin( phi1_rad ), 1.5 );
D = x / ( N1 * K0 );
latitude = phi1_rad - ( N1 * tan( phi1_rad ) / R1 ) * ( D * D / 2 -( 5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared ) * D * D * D * D / 24 + ( 61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1 ) * D * D * D * D * D * D / 720 );
- latitude = latitude * 180.0 / M_PI;
+ latitude = RAD2DEG(latitude);
longitude = ( D - ( 1 + 2 * T1 + C1 ) * D * D * D / 6 + ( 5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1 ) * D * D * D * D * D / 120 ) / cos( phi1_rad );
- longitude = long_origin + longitude * 180.0 / M_PI;
+ longitude = long_origin + RAD2DEG(longitude);
/* Show results. */
vik_coord_load_from_latlon ( &gps, vik_viewport_get_coord_mode(vp), &ll);
vik_viewport_coord_to_screen ( vp, &gps, &x, &y );
- gdouble heading_cos = cos(M_PI/180*vgl->realtime_fix.fix.track);
- gdouble heading_sin = sin(M_PI/180*vgl->realtime_fix.fix.track);
+ gdouble heading_cos = cos(DEG2RAD(vgl->realtime_fix.fix.track));
+ gdouble heading_sin = sin(DEG2RAD(vgl->realtime_fix.fix.track));
half_back_y = y+8*heading_cos;
half_back_x = x-8*heading_sin;
gdouble len = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
gdouble dx = (x2-x1)/len*10;
gdouble dy = (y2-y1)/len*10;
- gdouble c = cos(15.0 * M_PI/180.0);
- gdouble s = sin(15.0 * M_PI/180.0);
+ gdouble c = cos(DEG2RAD(15.0));
+ gdouble s = sin(DEG2RAD(15.0));
gdouble angle;
gdouble baseangle = 0;
gint i;
gdk_color_parse("#2255cc", &color);
gdk_gc_set_rgb_fg_color(thickgc, &color);
}
- gdk_draw_arc (d, thickgc, FALSE, x1-CR+CW/2, y1-CR+CW/2, 2*CR-CW, 2*CR-CW, (90 - baseangle*180/M_PI)*64, -angle*180/M_PI*64);
+ gdk_draw_arc (d, thickgc, FALSE, x1-CR+CW/2, y1-CR+CW/2, 2*CR-CW, 2*CR-CW, (90 - RAD2DEG(baseangle))*64, -RAD2DEG(angle)*64);
gdk_gc_copy(thickgc, gc);
gdk_gc_set_line_attributes(thickgc, 2, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
for (i=0; i<180; i++) {
- c = cos(i*M_PI/90.0 + baseangle);
- s = sin(i*M_PI/90.0 + baseangle);
+ c = cos(DEG2RAD(i)*2 + baseangle);
+ s = sin(DEG2RAD(i)*2 + baseangle);
if (i%5) {
gdk_draw_line (d, gc, x1 + CR*c, y1 + CR*s, x1 + (CR+CW)*c, y1 + (CR+CW)*s);
LABEL(xd, yd, wd, hd);
/* draw label with bearing */
- g_sprintf(str, "%3.1f°", angle*180.0/M_PI);
+ g_sprintf(str, "%3.1f°", RAD2DEG(angle));
pango_layout_set_text(pl, str, -1);
pango_layout_get_pixel_size ( pl, &wb, &hb );
xb = x1 + CR*cos(angle-M_PI_2);