From ff94fb2d1395644838dd247aa0643c27878afd99 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sun, 1 Dec 2002 15:37:51 +0000 Subject: [PATCH] Changed M_PI to G_PI. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@197 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/src/print.c | 20 ++++++++++---------- glabels2/src/view.c | 32 ++++++++++++++++---------------- glabels2/src/wdgt-vector.c | 10 +++------- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/glabels2/src/print.c b/glabels2/src/print.c index fb7f36ee..e6fcd109 100644 --- a/glabels2/src/print.c +++ b/glabels2/src/print.c @@ -1098,8 +1098,8 @@ create_ellipse_path (GnomePrintContext *pc, gnome_print_newpath (pc); gnome_print_moveto (pc, x0 + rx, y0); for (i_theta = 2; i_theta <= 360; i_theta += 2) { - x = x0 + rx * cos (i_theta * M_PI / 180.0); - y = y0 + ry * sin (i_theta * M_PI / 180.0); + x = x0 + rx * cos (i_theta * G_PI / 180.0); + y = y0 + ry * sin (i_theta * G_PI / 180.0); gnome_print_lineto (pc, x, y); } gnome_print_closepath (pc); @@ -1124,23 +1124,23 @@ create_rounded_rectangle_path (GnomePrintContext *pc, gnome_print_moveto (pc, x0 + r, y0); for (i_theta = 5; i_theta <= 90; i_theta += 5) { - x = x0 + r - r * sin (i_theta * M_PI / 180.0); - y = y0 + r - r * cos (i_theta * M_PI / 180.0); + x = x0 + r - r * sin (i_theta * G_PI / 180.0); + y = y0 + r - r * cos (i_theta * G_PI / 180.0); gnome_print_lineto (pc, x, y); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { - x = x0 + r - r * cos (i_theta * M_PI / 180.0); - y = y0 + (h - r) + r * sin (i_theta * M_PI / 180.0); + x = x0 + r - r * cos (i_theta * G_PI / 180.0); + y = y0 + (h - r) + r * sin (i_theta * G_PI / 180.0); gnome_print_lineto (pc, x, y); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { - x = x0 + (w - r) + r * sin (i_theta * M_PI / 180.0); - y = y0 + (h - r) + r * cos (i_theta * M_PI / 180.0); + x = x0 + (w - r) + r * sin (i_theta * G_PI / 180.0); + y = y0 + (h - r) + r * cos (i_theta * G_PI / 180.0); gnome_print_lineto (pc, x, y); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { - x = x0 + (w - r) + r * cos (i_theta * M_PI / 180.0); - y = y0 + r - r * sin (i_theta * M_PI / 180.0); + x = x0 + (w - r) + r * cos (i_theta * G_PI / 180.0); + y = y0 + r - r * sin (i_theta * G_PI / 180.0); gnome_print_lineto (pc, x, y); } gnome_print_lineto (pc, x0 + r, y0); diff --git a/glabels2/src/view.c b/glabels2/src/view.c index 205f4231..be0e5ad2 100644 --- a/glabels2/src/view.c +++ b/glabels2/src/view.c @@ -683,27 +683,27 @@ draw_bg_fg_rounded_rect (glView *view) i_coords = 0; for (i_theta = 0; i_theta <= 90; i_theta += 5) { points->coords[i_coords++] = - r - r * sin (i_theta * M_PI / 180.0); + r - r * sin (i_theta * G_PI / 180.0); points->coords[i_coords++] = - r - r * cos (i_theta * M_PI / 180.0); + r - r * cos (i_theta * G_PI / 180.0); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { points->coords[i_coords++] = - r - r * cos (i_theta * M_PI / 180.0); + r - r * cos (i_theta * G_PI / 180.0); points->coords[i_coords++] = - (h - r) + r * sin (i_theta * M_PI / 180.0); + (h - r) + r * sin (i_theta * G_PI / 180.0); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { points->coords[i_coords++] = - (w - r) + r * sin (i_theta * M_PI / 180.0); + (w - r) + r * sin (i_theta * G_PI / 180.0); points->coords[i_coords++] = - (h - r) + r * cos (i_theta * M_PI / 180.0); + (h - r) + r * cos (i_theta * G_PI / 180.0); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { points->coords[i_coords++] = - (w - r) + r * cos (i_theta * M_PI / 180.0); + (w - r) + r * cos (i_theta * G_PI / 180.0); points->coords[i_coords++] = - r - r * sin (i_theta * M_PI / 180.0); + r - r * sin (i_theta * G_PI / 180.0); } /* Background */ @@ -1059,27 +1059,27 @@ draw_markup_margin_rounded_rect (glView *view, i_coords = 0; for (i_theta = 0; i_theta <= 90; i_theta += 5) { points->coords[i_coords++] = - m + r - r * sin (i_theta * M_PI / 180.0); + m + r - r * sin (i_theta * G_PI / 180.0); points->coords[i_coords++] = - m + r - r * cos (i_theta * M_PI / 180.0); + m + r - r * cos (i_theta * G_PI / 180.0); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { points->coords[i_coords++] = - m + r - r * cos (i_theta * M_PI / 180.0); + m + r - r * cos (i_theta * G_PI / 180.0); points->coords[i_coords++] = - m + (h - r) + r * sin (i_theta * M_PI / 180.0); + m + (h - r) + r * sin (i_theta * G_PI / 180.0); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { points->coords[i_coords++] = - m + (w - r) + r * sin (i_theta * M_PI / 180.0); + m + (w - r) + r * sin (i_theta * G_PI / 180.0); points->coords[i_coords++] = - m + (h - r) + r * cos (i_theta * M_PI / 180.0); + m + (h - r) + r * cos (i_theta * G_PI / 180.0); } for (i_theta = 0; i_theta <= 90; i_theta += 5) { points->coords[i_coords++] = - m + (w - r) + r * cos (i_theta * M_PI / 180.0); + m + (w - r) + r * cos (i_theta * G_PI / 180.0); points->coords[i_coords++] = - m + r - r * sin (i_theta * M_PI / 180.0); + m + r - r * sin (i_theta * G_PI / 180.0); } item = gnome_canvas_item_new (view->markup_group, gnome_canvas_polygon_get_type (), diff --git a/glabels2/src/wdgt-vector.c b/glabels2/src/wdgt-vector.c index b67919d2..34ec89d9 100644 --- a/glabels2/src/wdgt-vector.c +++ b/glabels2/src/wdgt-vector.c @@ -30,14 +30,10 @@ #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 /* pi */ -#endif - #define LENGTH(x,y) sqrt( (x)*(x) + (y)*(y) ) -#define ANGLE(x,y) ( (180.0/M_PI)*atan2( -(y), (x) ) ) -#define COMP_X(l,a) ( (l) * cos( (M_PI/180.0)*(a) ) ) -#define COMP_Y(l,a) ( -(l) * sin( (M_PI/180.0)*(a) ) ) +#define ANGLE(x,y) ( (180.0/G_PI)*atan2( -(y), (x) ) ) +#define COMP_X(l,a) ( (l) * cos( (G_PI/180.0)*(a) ) ) +#define COMP_Y(l,a) ( -(l) * sin( (G_PI/180.0)*(a) ) ) /*===========================================*/ /* Private types */ -- 2.39.5