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);
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);
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 */
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 (),
#include <math.h>
-#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 */