Define ROUND(), RINT(), SQR(), G_PI and G_PI_4. The latter two will

* app/appenv.h: Define ROUND(), RINT(), SQR(), G_PI and
	G_PI_4. The latter two will presumably eventually be in
	GLib. RINT() calls rint() if we have it, otherwise adds 0.5 and
	calls floor().

	* app/*.c: Remove the multiple identical definitions of M_PI. Use
	G_PI instead of M_PI. Remove ROUND() and rint() definitions. Use
	RINT() instead of rint().
This commit is contained in:
Tor Lillqvist 1999-08-04 23:22:29 +00:00
parent b41809f812
commit 933b866166
57 changed files with 182 additions and 376 deletions

View File

@ -1,3 +1,14 @@
1999-08-05 Tor Lillqvist <tml@iki.fi>
* app/appenv.h: Define ROUND(), RINT(), SQR(), G_PI and
G_PI_4. The latter two will presumably eventually be in
GLib. RINT() calls rint() if we have it, otherwise adds 0.5 and
calls floor().
* app/*.c: Remove the multiple identical definitions of M_PI. Use
G_PI instead of M_PI. Remove ROUND() and rint() definitions. Use
RINT() instead of rint().
Tue Aug 3 22:16:57 MEST 1999 Sven Neumann <sven@gimp.org>
* app/interface.c: My last change to the dnd code did fix the bug

View File

@ -42,6 +42,24 @@
#define MINIMUM(x,y) MIN(x,y)
#define MAXIMUM(x,y) MAX(x,y)
#ifndef G_PI /* G_PI will be in GLib eventually */
#define G_PI 3.14159265358979323846
#endif
#ifndef G_PI_4 /* As will G_PI_4 */
#define G_PI_4 0.78539816339744830962
#endif
#ifdef HAVE_RINT
#define RINT(x) rint(x)
#else
#define RINT(x) floor ((x)+0.5)
#endif
#define ROUND(x) ((int) ((x)+0.5))
/* Square */
#define SQR(x) ((x)*(x))
/* limit a (0->511) int to 255 */
#define MAX255(a) ((a) | (((a) & 256) - (((a) & 256) >> 8)))

View File

@ -33,8 +33,6 @@
#include "libgimp/gimpintl.h"
#define ROUND(x) ((int) ((x) + 0.5))
#define GRAPH 0x1
#define XRANGE_TOP 0x2
#define XRANGE_BOTTOM 0x4

View File

@ -18,15 +18,13 @@
#include "config.h"
#include "gimplut.h"
#include "gimphistogram.h"
#include <stdio.h>
#include <math.h>
#include <stdio.h>
#include <glib.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "gimplut.h"
#include "gimphistogram.h"
/* ---------- Brightness/Contrast -----------*/
@ -329,7 +327,7 @@ posterize_lut_func(int *ilevels,
else
levels = *ilevels;
value = rint(value * (levels - 1.0)) / (levels - 1.0);
value = RINT(value * (levels - 1.0)) / (levels - 1.0);
return value;
}

View File

@ -35,10 +35,6 @@
#include "libgimp/gimpintl.h"
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
/* Bezier extensions made by Raphael FRANCOIS (fraph@ibm.net)
BEZIER_EXTENDS VER 1.0
@ -67,8 +63,6 @@
#define NO 0
#define YES 1
#define ROUND(x) ((int) ((x) + 0.5))
/* the bezier select structures */
typedef double BezierMatrix[4][4];
@ -1946,8 +1940,6 @@ bezier_draw_segment (BezierSelect *bezier_sel,
BezierPointsFunc points_func,
gpointer udata)
{
#define ROUND(x) ((int) ((x) + 0.5))
static GdkPoint gdk_points[256];
static int npoints = 256;
@ -2621,8 +2613,8 @@ test_add_point_on_segment (BezierSelect *bezier_sel,
geometry[i][1] = points->y;
break;
case AA_IMAGE_COORDS:
geometry[i][0] = rint(points->x * SUPERSAMPLE);
geometry[i][1] = rint(points->y * SUPERSAMPLE);
geometry[i][0] = RINT(points->x * SUPERSAMPLE);
geometry[i][1] = RINT(points->y * SUPERSAMPLE);
break;
case SCREEN_COORDS:
geometry[i][0] = points->sx;
@ -3289,8 +3281,8 @@ bezier_draw_segment_for_distance (BezierSelect *bezier_sel,
bdist->curdist += sqrt((dx*dx)+(dy*dy));
if(bdist->curdist >= bdist->dist)
{
*(bdist->x) = (gint)ROUND((rx + dx/2));
*(bdist->y) = (gint)ROUND((ry + dy/2));
*(bdist->x) = ROUND((rx + dx/2));
*(bdist->y) = ROUND((ry + dy/2));
if(dx == 0.0)
*(bdist->gradient) = G_MAXDOUBLE;
else

View File

@ -45,12 +45,6 @@
#define TARGET_HEIGHT 15
#define TARGET_WIDTH 15
#define SQR(x) ((x) * (x))
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define STATUSBAR_SIZE 128
/* the blend structures */
@ -869,7 +863,7 @@ gradient_calc_conical_sym_factor (double dist,
/* This cool idea is courtesy Josh MacDonald,
* Ali Rahimi --- two more XCF losers. */
rat = acos(rat) / M_PI;
rat = acos(rat) / G_PI;
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
@ -900,15 +894,15 @@ gradient_calc_conical_asym_factor (double dist,
{
if ((x != 0) || (y != 0))
{
ang0 = atan2(axis[0], axis[1]) + M_PI;
ang1 = atan2(x, y) + M_PI;
ang0 = atan2(axis[0], axis[1]) + G_PI;
ang1 = atan2(x, y) + G_PI;
ang = ang1 - ang0;
if (ang < 0.0)
ang += (2.0 * M_PI);
ang += (2.0 * G_PI);
rat = ang / (2.0 * M_PI);
rat = ang / (2.0 * G_PI);
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
@ -1064,18 +1058,18 @@ gradient_calc_spiral_factor (double dist,
{
if (x != 0.0 || y != 0.0)
{
ang0 = atan2 (axis[0], axis[1]) + M_PI;
ang1 = atan2 (x, y) + M_PI;
ang0 = atan2 (axis[0], axis[1]) + G_PI;
ang1 = atan2 (x, y) + G_PI;
if(!cwise)
ang = ang0 - ang1;
else
ang = ang1 - ang0;
if (ang < 0.0)
ang += (2.0 * M_PI);
ang += (2.0 * G_PI);
r = sqrt (x * x + y * y) / dist;
rat = ang / (2.0 * M_PI) + r + offset;
rat = ang / (2.0 * G_PI) + r + offset;
rat = fmod (rat, 1.0);
}
else
@ -1115,7 +1109,7 @@ gradient_calc_shapeburst_spherical_factor (double x,
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * M_PI * value);
value = 1.0 - sin (0.5 * G_PI * value);
tile_release (tile, FALSE);
return value;
@ -1134,7 +1128,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * M_PI * value);
value = cos (0.5 * G_PI * value);
tile_release (tile, FALSE);
return value;

View File

@ -29,11 +29,7 @@
#include <stdlib.h>
#include <string.h>
#define ROUND(A) floor((A)+0.5)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#include "appenv.h"
static Blob *
blob_new (int y, int height)
@ -621,7 +617,7 @@ blob_ellipse (double xc, double yc, double xp, double yp, double xq, double yq)
{
trig_initialized = 1;
for (i=0; i<256; i++)
trig_table[i] = 0.5 + sin(i * (M_PI / 128.)) * (1 << TABLE_SHIFT);
trig_table[i] = 0.5 + sin(i * (G_PI / 128.)) * (1 << TABLE_SHIFT);
}
/* Make sure we traverse ellipse in ccw direction */

View File

@ -101,8 +101,6 @@ gimp_channel_init (GimpChannel *channel)
{
}
#define ROUND(x) ((int) (x + 0.5))
/*
* Static variables
*/

View File

@ -24,14 +24,6 @@
#include <stdio.h>
#include <string.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "paint_core.h"
@ -260,8 +252,8 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
temp_buf_free(gbrush->mask);
}
/* compute the range of the brush. should do a better job than this? */
s = sin(brush->angle*M_PI/180.0);
c = cos(brush->angle*M_PI/180.0);
s = sin(brush->angle*G_PI/180.0);
c = cos(brush->angle*G_PI/180.0);
tx = MAXIMUM(fabs(c*ceil(brush->radius) - s*ceil(brush->radius)
/brush->aspect_ratio),
fabs(c*ceil(brush->radius) + s*ceil(brush->radius)
@ -316,7 +308,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
/* buffer[x%OVERSAMPLING] = (1.0 - pow(d/brush->radius, exponent));*/
buffer[x%OVERSAMPLING] = gauss(pow(d/brush->radius, exponent));
sum += buffer[x%OVERSAMPLING];
lookup[x++] = rint(sum*(255.0/OVERSAMPLING));
lookup[x++] = RINT(sum*(255.0/OVERSAMPLING));
}
while (x < length)
{
@ -332,7 +324,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
ty *= brush->aspect_ratio;
d = sqrt(tx*tx + ty*ty);
if (d < brush->radius+1)
a = lookup[(int)rint(d*OVERSAMPLING)];
a = lookup[(int)RINT(d*OVERSAMPLING)];
else
a = 0;
centerp[ y*gbrush->mask->width + x] = a;

View File

@ -24,14 +24,6 @@
#include <stdio.h>
#include <string.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "paint_core.h"
@ -260,8 +252,8 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
temp_buf_free(gbrush->mask);
}
/* compute the range of the brush. should do a better job than this? */
s = sin(brush->angle*M_PI/180.0);
c = cos(brush->angle*M_PI/180.0);
s = sin(brush->angle*G_PI/180.0);
c = cos(brush->angle*G_PI/180.0);
tx = MAXIMUM(fabs(c*ceil(brush->radius) - s*ceil(brush->radius)
/brush->aspect_ratio),
fabs(c*ceil(brush->radius) + s*ceil(brush->radius)
@ -316,7 +308,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
/* buffer[x%OVERSAMPLING] = (1.0 - pow(d/brush->radius, exponent));*/
buffer[x%OVERSAMPLING] = gauss(pow(d/brush->radius, exponent));
sum += buffer[x%OVERSAMPLING];
lookup[x++] = rint(sum*(255.0/OVERSAMPLING));
lookup[x++] = RINT(sum*(255.0/OVERSAMPLING));
}
while (x < length)
{
@ -332,7 +324,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
ty *= brush->aspect_ratio;
d = sqrt(tx*tx + ty*ty);
if (d < brush->radius+1)
a = lookup[(int)rint(d*OVERSAMPLING)];
a = lookup[(int)RINT(d*OVERSAMPLING)];
else
a = 0;
centerp[ y*gbrush->mask->width + x] = a;

View File

@ -24,14 +24,6 @@
#include <stdio.h>
#include <string.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "paint_core.h"
@ -260,8 +252,8 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
temp_buf_free(gbrush->mask);
}
/* compute the range of the brush. should do a better job than this? */
s = sin(brush->angle*M_PI/180.0);
c = cos(brush->angle*M_PI/180.0);
s = sin(brush->angle*G_PI/180.0);
c = cos(brush->angle*G_PI/180.0);
tx = MAXIMUM(fabs(c*ceil(brush->radius) - s*ceil(brush->radius)
/brush->aspect_ratio),
fabs(c*ceil(brush->radius) + s*ceil(brush->radius)
@ -316,7 +308,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
/* buffer[x%OVERSAMPLING] = (1.0 - pow(d/brush->radius, exponent));*/
buffer[x%OVERSAMPLING] = gauss(pow(d/brush->radius, exponent));
sum += buffer[x%OVERSAMPLING];
lookup[x++] = rint(sum*(255.0/OVERSAMPLING));
lookup[x++] = RINT(sum*(255.0/OVERSAMPLING));
}
while (x < length)
{
@ -332,7 +324,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
ty *= brush->aspect_ratio;
d = sqrt(tx*tx + ty*ty);
if (d < brush->radius+1)
a = lookup[(int)rint(d*OVERSAMPLING)];
a = lookup[(int)RINT(d*OVERSAMPLING)];
else
a = 0;
centerp[ y*gbrush->mask->width + x] = a;

View File

@ -101,8 +101,6 @@ gimp_channel_init (GimpChannel *channel)
{
}
#define ROUND(x) ((int) (x + 0.5))
/*
* Static variables
*/

View File

@ -101,8 +101,6 @@ gimp_channel_init (GimpChannel *channel)
{
}
#define ROUND(x) ((int) (x + 0.5))
/*
* Static variables
*/

View File

@ -45,12 +45,6 @@
#define TARGET_HEIGHT 15
#define TARGET_WIDTH 15
#define SQR(x) ((x) * (x))
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define STATUSBAR_SIZE 128
/* the blend structures */
@ -869,7 +863,7 @@ gradient_calc_conical_sym_factor (double dist,
/* This cool idea is courtesy Josh MacDonald,
* Ali Rahimi --- two more XCF losers. */
rat = acos(rat) / M_PI;
rat = acos(rat) / G_PI;
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
@ -900,15 +894,15 @@ gradient_calc_conical_asym_factor (double dist,
{
if ((x != 0) || (y != 0))
{
ang0 = atan2(axis[0], axis[1]) + M_PI;
ang1 = atan2(x, y) + M_PI;
ang0 = atan2(axis[0], axis[1]) + G_PI;
ang1 = atan2(x, y) + G_PI;
ang = ang1 - ang0;
if (ang < 0.0)
ang += (2.0 * M_PI);
ang += (2.0 * G_PI);
rat = ang / (2.0 * M_PI);
rat = ang / (2.0 * G_PI);
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
@ -1064,18 +1058,18 @@ gradient_calc_spiral_factor (double dist,
{
if (x != 0.0 || y != 0.0)
{
ang0 = atan2 (axis[0], axis[1]) + M_PI;
ang1 = atan2 (x, y) + M_PI;
ang0 = atan2 (axis[0], axis[1]) + G_PI;
ang1 = atan2 (x, y) + G_PI;
if(!cwise)
ang = ang0 - ang1;
else
ang = ang1 - ang0;
if (ang < 0.0)
ang += (2.0 * M_PI);
ang += (2.0 * G_PI);
r = sqrt (x * x + y * y) / dist;
rat = ang / (2.0 * M_PI) + r + offset;
rat = ang / (2.0 * G_PI) + r + offset;
rat = fmod (rat, 1.0);
}
else
@ -1115,7 +1109,7 @@ gradient_calc_shapeburst_spherical_factor (double x,
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * M_PI * value);
value = 1.0 - sin (0.5 * G_PI * value);
tile_release (tile, FALSE);
return value;
@ -1134,7 +1128,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * M_PI * value);
value = cos (0.5 * G_PI * value);
tile_release (tile, FALSE);
return value;

View File

@ -33,8 +33,6 @@
#include "libgimp/gimpintl.h"
#define ROUND(x) ((int) ((x) + 0.5))
#define GRAPH 0x1
#define XRANGE_TOP 0x2
#define XRANGE_BOTTOM 0x4

View File

@ -30,7 +30,6 @@
#include "libgimp/gimpintl.h"
#define DEFAULT_MAX_INC 1024
#define ROUND(x) ((int) (x + 0.5))
#define SUPERSAMPLE 3
#define SUPERSAMPLE2 9

View File

@ -24,14 +24,6 @@
#include <stdio.h>
#include <string.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "paint_core.h"
@ -260,8 +252,8 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
temp_buf_free(gbrush->mask);
}
/* compute the range of the brush. should do a better job than this? */
s = sin(brush->angle*M_PI/180.0);
c = cos(brush->angle*M_PI/180.0);
s = sin(brush->angle*G_PI/180.0);
c = cos(brush->angle*G_PI/180.0);
tx = MAXIMUM(fabs(c*ceil(brush->radius) - s*ceil(brush->radius)
/brush->aspect_ratio),
fabs(c*ceil(brush->radius) + s*ceil(brush->radius)
@ -316,7 +308,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
/* buffer[x%OVERSAMPLING] = (1.0 - pow(d/brush->radius, exponent));*/
buffer[x%OVERSAMPLING] = gauss(pow(d/brush->radius, exponent));
sum += buffer[x%OVERSAMPLING];
lookup[x++] = rint(sum*(255.0/OVERSAMPLING));
lookup[x++] = RINT(sum*(255.0/OVERSAMPLING));
}
while (x < length)
{
@ -332,7 +324,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
ty *= brush->aspect_ratio;
d = sqrt(tx*tx + ty*ty);
if (d < brush->radius+1)
a = lookup[(int)rint(d*OVERSAMPLING)];
a = lookup[(int)RINT(d*OVERSAMPLING)];
else
a = 0;
centerp[ y*gbrush->mask->width + x] = a;

View File

@ -101,8 +101,6 @@ gimp_channel_init (GimpChannel *channel)
{
}
#define ROUND(x) ((int) (x + 0.5))
/*
* Static variables
*/

View File

@ -172,10 +172,6 @@
/***** Magic numbers *****/
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define EPSILON 1e-10
@ -5945,7 +5941,7 @@ calc_sine_factor(double middle, double pos)
{
pos = calc_linear_factor(middle, pos);
return (sin((-M_PI / 2.0) + M_PI * pos) + 1.0) / 2.0;
return (sin((-G_PI / 2.0) + G_PI * pos) + 1.0) / 2.0;
} /* calc_sine_factor */

View File

@ -172,10 +172,6 @@
/***** Magic numbers *****/
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define EPSILON 1e-10
@ -5945,7 +5941,7 @@ calc_sine_factor(double middle, double pos)
{
pos = calc_linear_factor(middle, pos);
return (sin((-M_PI / 2.0) + M_PI * pos) + 1.0) / 2.0;
return (sin((-G_PI / 2.0) + G_PI * pos) + 1.0) / 2.0;
} /* calc_sine_factor */

View File

@ -172,10 +172,6 @@
/***** Magic numbers *****/
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define EPSILON 1e-10
@ -5945,7 +5941,7 @@ calc_sine_factor(double middle, double pos)
{
pos = calc_linear_factor(middle, pos);
return (sin((-M_PI / 2.0) + M_PI * pos) + 1.0) / 2.0;
return (sin((-G_PI / 2.0) + G_PI * pos) + 1.0) / 2.0;
} /* calc_sine_factor */

View File

@ -23,6 +23,7 @@
#include <string.h>
#include <errno.h>
#include <math.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "draw_core.h"
@ -54,6 +55,7 @@
#include "undo.h"
#include "drawable_pvt.h"
#include "libgimp/gimpintl.h"
#include "pixmaps/new.xpm"
@ -69,10 +71,6 @@
#include "pixmaps/path.xbm"
#include "pixmaps/locked.xbm"
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | \
GDK_ENTER_NOTIFY_MASK
@ -634,8 +632,8 @@ path_to_beziersel(PATHP bzp)
}
bezier_add_point(bezier_sel,
(gint)pdata->type,
rint(pdata->x), /* ALT add rint() */
rint(pdata->y));
RINT(pdata->x), /* ALT add rint() */
RINT(pdata->y));
if(bpnt == NULL)
bpnt = bezier_sel->last_point;
list = g_slist_next(list);

View File

@ -35,10 +35,6 @@
#include "tile.h" /* ick. */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define SUBSAMPLE 8
#define DIST_SMOOTHER_BUFFER 10
@ -775,8 +771,8 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
both as affine transforms would make the most sense. -RLL */
tscale = ink_options->tilt_sensitivity * 10.0;
tscale_c = tscale * cos (ink_options->tilt_angle * M_PI / 180);
tscale_s = tscale * sin (ink_options->tilt_angle * M_PI / 180);
tscale_c = tscale * cos (ink_options->tilt_angle * G_PI / 180);
tscale_s = tscale * sin (ink_options->tilt_angle * G_PI / 180);
x = ink_options->aspect*cos(ink_options->angle) +
xtilt * tscale_c - ytilt * tscale_s;
y = ink_options->aspect*sin(ink_options->angle) +

View File

@ -20,9 +20,10 @@
* thanks to Professor D. Forsyth for prompting us to implement this tool
*/
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "draw_core.h"
#include "channel_pvt.h"
@ -42,13 +43,6 @@
#include "libgimp/gimpintl.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#ifndef M_PI_4
#define M_PI_4 0.78539816339744830962
#endif /* M_PI_4 */
/* the intelligent scissors structures */
typedef struct _Kink Kink;
@ -708,8 +702,6 @@ iscissors_draw_CR (GDisplay *gdisp,
int *indices,
int draw_type)
{
#define ROUND(x) ((int) ((x) + 0.5))
static GdkPoint gdk_points[256];
static int npoints = 256;
@ -1359,7 +1351,7 @@ shape_of_boundary (Tool *tool)
normalize (vec2);
/* determine the kinkiness based on the two vectors */
kinks[i].kinkiness = (M_PI - acos (dotprod (vec1, vec2)))/ M_PI;
kinks[i].kinkiness = (G_PI - acos (dotprod (vec1, vec2)))/ G_PI;
kinks[i].normal[0] = (vec1[0] + vec2[0]) / 2.0;
kinks[i].normal[1] = (vec1[1] + vec2[1]) / 2.0;
@ -1552,7 +1544,7 @@ orient_boundary (Tool *tool)
found = 0;
angle = atan2 (pts[i].normal[1], pts[i].normal[0]);
dir = ((angle > -3 * M_PI_4) && (angle < M_PI_4)) ? 1 : -1;
dir = ((angle > -3 * G_PI_4) && (angle < G_PI_4)) ? 1 : -1;
while (j < LOCALIZE_RADIUS && !found)
{

View File

@ -18,15 +18,13 @@
#include "config.h"
#include "gimplut.h"
#include "gimphistogram.h"
#include <stdio.h>
#include <math.h>
#include <stdio.h>
#include <glib.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "gimplut.h"
#include "gimphistogram.h"
/* ---------- Brightness/Contrast -----------*/
@ -329,7 +327,7 @@ posterize_lut_func(int *ilevels,
else
levels = *ilevels;
value = rint(value * (levels - 1.0)) / (levels - 1.0);
value = RINT(value * (levels - 1.0)) / (levels - 1.0);
return value;
}

View File

@ -23,10 +23,6 @@
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "gimprc.h"
#include "paint_funcs.h"
@ -4296,7 +4292,7 @@ compute_border(gint16 *circ, guint16 xradius, guint16 yradius)
tmp = (xradius - i) - .5;
else
tmp = 0.0;
circ[i] = rint(yradius/(double)xradius *
circ[i] = RINT(yradius/(double)xradius *
sqrt((xradius)*(xradius) - (tmp)*(tmp)));
}
}

View File

@ -29,11 +29,7 @@
#include <stdlib.h>
#include <string.h>
#define ROUND(A) floor((A)+0.5)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#include "appenv.h"
static Blob *
blob_new (int y, int height)
@ -621,7 +617,7 @@ blob_ellipse (double xc, double yc, double xp, double yp, double xq, double yq)
{
trig_initialized = 1;
for (i=0; i<256; i++)
trig_table[i] = 0.5 + sin(i * (M_PI / 128.)) * (1 << TABLE_SHIFT);
trig_table[i] = 0.5 + sin(i * (G_PI / 128.)) * (1 << TABLE_SHIFT);
}
/* Make sure we traverse ellipse in ccw direction */

View File

@ -35,10 +35,6 @@
#include "tile.h" /* ick. */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define SUBSAMPLE 8
#define DIST_SMOOTHER_BUFFER 10
@ -775,8 +771,8 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
both as affine transforms would make the most sense. -RLL */
tscale = ink_options->tilt_sensitivity * 10.0;
tscale_c = tscale * cos (ink_options->tilt_angle * M_PI / 180);
tscale_s = tscale * sin (ink_options->tilt_angle * M_PI / 180);
tscale_c = tscale * cos (ink_options->tilt_angle * G_PI / 180);
tscale_s = tscale * sin (ink_options->tilt_angle * G_PI / 180);
x = ink_options->aspect*cos(ink_options->angle) +
xtilt * tscale_c - ytilt * tscale_s;
y = ink_options->aspect*sin(ink_options->angle) +

View File

@ -33,8 +33,6 @@
#include "tools.h"
#include "gimage.h"
#define ROUND(x) (int)((x) + .5)
#include "libgimp/gimpintl.h"

View File

@ -23,10 +23,6 @@
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "gimprc.h"
#include "paint_funcs.h"
@ -4296,7 +4292,7 @@ compute_border(gint16 *circ, guint16 xradius, guint16 yradius)
tmp = (xradius - i) - .5;
else
tmp = 0.0;
circ[i] = rint(yradius/(double)xradius *
circ[i] = RINT(yradius/(double)xradius *
sqrt((xradius)*(xradius) - (tmp)*(tmp)));
}
}

View File

@ -23,6 +23,7 @@
#include <string.h>
#include <errno.h>
#include <math.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "draw_core.h"
@ -54,6 +55,7 @@
#include "undo.h"
#include "drawable_pvt.h"
#include "libgimp/gimpintl.h"
#include "pixmaps/new.xpm"
@ -69,10 +71,6 @@
#include "pixmaps/path.xbm"
#include "pixmaps/locked.xbm"
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | \
GDK_ENTER_NOTIFY_MASK
@ -634,8 +632,8 @@ path_to_beziersel(PATHP bzp)
}
bezier_add_point(bezier_sel,
(gint)pdata->type,
rint(pdata->x), /* ALT add rint() */
rint(pdata->y));
RINT(pdata->x), /* ALT add rint() */
RINT(pdata->y));
if(bpnt == NULL)
bpnt = bezier_sel->last_point;
list = g_slist_next(list);

View File

@ -22,10 +22,6 @@
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "actionarea.h"
#include "drawable.h"

View File

@ -34,10 +34,6 @@
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
/* index into trans_info array */
#define ANGLE 0
#define REAL_ANGLE 1
@ -45,7 +41,7 @@
#define CENTER_Y 3
#define EPSILON 0.018 /* ~ 1 degree */
#define FIFTEEN_DEG (M_PI / 12.0)
#define FIFTEEN_DEG (G_PI / 12.0)
/* variables local to this file */
static gdouble angle_val;
@ -224,7 +220,7 @@ rotate_info_update (Tool *tool)
transform_core = (TransformCore *) tool->private;
angle_val = (transform_core->trans_info[ANGLE] * 180.0) / M_PI;
angle_val = (transform_core->trans_info[ANGLE] * 180.0) / G_PI;
center_vals[0] = transform_core->cx;
center_vals[1] = transform_core->cy;
@ -248,7 +244,7 @@ rotate_angle_changed (GtkWidget *w,
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
value = GTK_ADJUSTMENT (w)->value * M_PI / 180.0;
value = GTK_ADJUSTMENT (w)->value * G_PI / 180.0;
if (value != transform_core->trans_info[ANGLE])
{
@ -327,19 +323,19 @@ rotate_tool_motion (Tool *tool,
angle = angle2 - angle1;
if (angle > M_PI || angle < -M_PI)
angle = angle2 - ((angle1 < 0) ? 2*M_PI + angle1 : angle1 - 2*M_PI);
if (angle > G_PI || angle < -G_PI)
angle = angle2 - ((angle1 < 0) ? 2*G_PI + angle1 : angle1 - 2*G_PI);
/* increment the transform tool's angle */
transform_core->trans_info[REAL_ANGLE] += angle;
/* limit the angle to between 0 and 360 degrees */
if (transform_core->trans_info[REAL_ANGLE] < - M_PI)
if (transform_core->trans_info[REAL_ANGLE] < - G_PI)
transform_core->trans_info[REAL_ANGLE] =
2 * M_PI - transform_core->trans_info[REAL_ANGLE];
else if (transform_core->trans_info[REAL_ANGLE] > M_PI)
2 * G_PI - transform_core->trans_info[REAL_ANGLE];
else if (transform_core->trans_info[REAL_ANGLE] > G_PI)
transform_core->trans_info[REAL_ANGLE] =
transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
transform_core->trans_info[REAL_ANGLE] - 2 * G_PI;
/* constrain the angle to 15-degree multiples if ctrl is held down */
if (transform_core->state & GDK_CONTROL_MASK)

View File

@ -33,8 +33,6 @@
#include "tools.h"
#include "gimage.h"
#define ROUND(x) (int)((x) + .5)
#include "libgimp/gimpintl.h"

View File

@ -35,10 +35,6 @@
#include "libgimp/gimpintl.h"
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
/* Bezier extensions made by Raphael FRANCOIS (fraph@ibm.net)
BEZIER_EXTENDS VER 1.0
@ -67,8 +63,6 @@
#define NO 0
#define YES 1
#define ROUND(x) ((int) ((x) + 0.5))
/* the bezier select structures */
typedef double BezierMatrix[4][4];
@ -1946,8 +1940,6 @@ bezier_draw_segment (BezierSelect *bezier_sel,
BezierPointsFunc points_func,
gpointer udata)
{
#define ROUND(x) ((int) ((x) + 0.5))
static GdkPoint gdk_points[256];
static int npoints = 256;
@ -2621,8 +2613,8 @@ test_add_point_on_segment (BezierSelect *bezier_sel,
geometry[i][1] = points->y;
break;
case AA_IMAGE_COORDS:
geometry[i][0] = rint(points->x * SUPERSAMPLE);
geometry[i][1] = rint(points->y * SUPERSAMPLE);
geometry[i][0] = RINT(points->x * SUPERSAMPLE);
geometry[i][1] = RINT(points->y * SUPERSAMPLE);
break;
case SCREEN_COORDS:
geometry[i][0] = points->sx;
@ -3289,8 +3281,8 @@ bezier_draw_segment_for_distance (BezierSelect *bezier_sel,
bdist->curdist += sqrt((dx*dx)+(dy*dy));
if(bdist->curdist >= bdist->dist)
{
*(bdist->x) = (gint)ROUND((rx + dx/2));
*(bdist->y) = (gint)ROUND((ry + dy/2));
*(bdist->x) = ROUND((rx + dx/2));
*(bdist->y) = ROUND((ry + dy/2));
if(dx == 0.0)
*(bdist->gradient) = G_MAXDOUBLE;
else

View File

@ -45,12 +45,6 @@
#define TARGET_HEIGHT 15
#define TARGET_WIDTH 15
#define SQR(x) ((x) * (x))
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define STATUSBAR_SIZE 128
/* the blend structures */
@ -869,7 +863,7 @@ gradient_calc_conical_sym_factor (double dist,
/* This cool idea is courtesy Josh MacDonald,
* Ali Rahimi --- two more XCF losers. */
rat = acos(rat) / M_PI;
rat = acos(rat) / G_PI;
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
@ -900,15 +894,15 @@ gradient_calc_conical_asym_factor (double dist,
{
if ((x != 0) || (y != 0))
{
ang0 = atan2(axis[0], axis[1]) + M_PI;
ang1 = atan2(x, y) + M_PI;
ang0 = atan2(axis[0], axis[1]) + G_PI;
ang1 = atan2(x, y) + G_PI;
ang = ang1 - ang0;
if (ang < 0.0)
ang += (2.0 * M_PI);
ang += (2.0 * G_PI);
rat = ang / (2.0 * M_PI);
rat = ang / (2.0 * G_PI);
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
@ -1064,18 +1058,18 @@ gradient_calc_spiral_factor (double dist,
{
if (x != 0.0 || y != 0.0)
{
ang0 = atan2 (axis[0], axis[1]) + M_PI;
ang1 = atan2 (x, y) + M_PI;
ang0 = atan2 (axis[0], axis[1]) + G_PI;
ang1 = atan2 (x, y) + G_PI;
if(!cwise)
ang = ang0 - ang1;
else
ang = ang1 - ang0;
if (ang < 0.0)
ang += (2.0 * M_PI);
ang += (2.0 * G_PI);
r = sqrt (x * x + y * y) / dist;
rat = ang / (2.0 * M_PI) + r + offset;
rat = ang / (2.0 * G_PI) + r + offset;
rat = fmod (rat, 1.0);
}
else
@ -1115,7 +1109,7 @@ gradient_calc_shapeburst_spherical_factor (double x,
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * M_PI * value);
value = 1.0 - sin (0.5 * G_PI * value);
tile_release (tile, FALSE);
return value;
@ -1134,7 +1128,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * M_PI * value);
value = cos (0.5 * G_PI * value);
tile_release (tile, FALSE);
return value;

View File

@ -29,11 +29,7 @@
#include <stdlib.h>
#include <string.h>
#define ROUND(A) floor((A)+0.5)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#include "appenv.h"
static Blob *
blob_new (int y, int height)
@ -621,7 +617,7 @@ blob_ellipse (double xc, double yc, double xp, double yp, double xq, double yq)
{
trig_initialized = 1;
for (i=0; i<256; i++)
trig_table[i] = 0.5 + sin(i * (M_PI / 128.)) * (1 << TABLE_SHIFT);
trig_table[i] = 0.5 + sin(i * (G_PI / 128.)) * (1 << TABLE_SHIFT);
}
/* Make sure we traverse ellipse in ccw direction */

View File

@ -33,8 +33,6 @@
#include "libgimp/gimpintl.h"
#define ROUND(x) ((int) ((x) + 0.5))
#define GRAPH 0x1
#define XRANGE_TOP 0x2
#define XRANGE_BOTTOM 0x4

View File

@ -30,7 +30,6 @@
#include "libgimp/gimpintl.h"
#define DEFAULT_MAX_INC 1024
#define ROUND(x) ((int) (x + 0.5))
#define SUPERSAMPLE 3
#define SUPERSAMPLE2 9

View File

@ -45,12 +45,6 @@
#define TARGET_HEIGHT 15
#define TARGET_WIDTH 15
#define SQR(x) ((x) * (x))
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define STATUSBAR_SIZE 128
/* the blend structures */
@ -869,7 +863,7 @@ gradient_calc_conical_sym_factor (double dist,
/* This cool idea is courtesy Josh MacDonald,
* Ali Rahimi --- two more XCF losers. */
rat = acos(rat) / M_PI;
rat = acos(rat) / G_PI;
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
@ -900,15 +894,15 @@ gradient_calc_conical_asym_factor (double dist,
{
if ((x != 0) || (y != 0))
{
ang0 = atan2(axis[0], axis[1]) + M_PI;
ang1 = atan2(x, y) + M_PI;
ang0 = atan2(axis[0], axis[1]) + G_PI;
ang1 = atan2(x, y) + G_PI;
ang = ang1 - ang0;
if (ang < 0.0)
ang += (2.0 * M_PI);
ang += (2.0 * G_PI);
rat = ang / (2.0 * M_PI);
rat = ang / (2.0 * G_PI);
rat = pow(rat, (offset / 10) + 1);
rat = BOUNDS(rat, 0.0, 1.0);
@ -1064,18 +1058,18 @@ gradient_calc_spiral_factor (double dist,
{
if (x != 0.0 || y != 0.0)
{
ang0 = atan2 (axis[0], axis[1]) + M_PI;
ang1 = atan2 (x, y) + M_PI;
ang0 = atan2 (axis[0], axis[1]) + G_PI;
ang1 = atan2 (x, y) + G_PI;
if(!cwise)
ang = ang0 - ang1;
else
ang = ang1 - ang0;
if (ang < 0.0)
ang += (2.0 * M_PI);
ang += (2.0 * G_PI);
r = sqrt (x * x + y * y) / dist;
rat = ang / (2.0 * M_PI) + r + offset;
rat = ang / (2.0 * G_PI) + r + offset;
rat = fmod (rat, 1.0);
}
else
@ -1115,7 +1109,7 @@ gradient_calc_shapeburst_spherical_factor (double x,
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * M_PI * value);
value = 1.0 - sin (0.5 * G_PI * value);
tile_release (tile, FALSE);
return value;
@ -1134,7 +1128,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * M_PI * value);
value = cos (0.5 * G_PI * value);
tile_release (tile, FALSE);
return value;

View File

@ -33,8 +33,6 @@
#include "libgimp/gimpintl.h"
#define ROUND(x) ((int) ((x) + 0.5))
#define GRAPH 0x1
#define XRANGE_TOP 0x2
#define XRANGE_BOTTOM 0x4

View File

@ -30,7 +30,6 @@
#include "libgimp/gimpintl.h"
#define DEFAULT_MAX_INC 1024
#define ROUND(x) ((int) (x + 0.5))
#define SUPERSAMPLE 3
#define SUPERSAMPLE2 9

View File

@ -29,11 +29,7 @@
#include <stdlib.h>
#include <string.h>
#define ROUND(A) floor((A)+0.5)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#include "appenv.h"
static Blob *
blob_new (int y, int height)
@ -621,7 +617,7 @@ blob_ellipse (double xc, double yc, double xp, double yp, double xq, double yq)
{
trig_initialized = 1;
for (i=0; i<256; i++)
trig_table[i] = 0.5 + sin(i * (M_PI / 128.)) * (1 << TABLE_SHIFT);
trig_table[i] = 0.5 + sin(i * (G_PI / 128.)) * (1 << TABLE_SHIFT);
}
/* Make sure we traverse ellipse in ccw direction */

View File

@ -35,10 +35,6 @@
#include "tile.h" /* ick. */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define SUBSAMPLE 8
#define DIST_SMOOTHER_BUFFER 10
@ -775,8 +771,8 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
both as affine transforms would make the most sense. -RLL */
tscale = ink_options->tilt_sensitivity * 10.0;
tscale_c = tscale * cos (ink_options->tilt_angle * M_PI / 180);
tscale_s = tscale * sin (ink_options->tilt_angle * M_PI / 180);
tscale_c = tscale * cos (ink_options->tilt_angle * G_PI / 180);
tscale_s = tscale * sin (ink_options->tilt_angle * G_PI / 180);
x = ink_options->aspect*cos(ink_options->angle) +
xtilt * tscale_c - ytilt * tscale_s;
y = ink_options->aspect*sin(ink_options->angle) +

View File

@ -20,9 +20,10 @@
* thanks to Professor D. Forsyth for prompting us to implement this tool
*/
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "draw_core.h"
#include "channel_pvt.h"
@ -42,13 +43,6 @@
#include "libgimp/gimpintl.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#ifndef M_PI_4
#define M_PI_4 0.78539816339744830962
#endif /* M_PI_4 */
/* the intelligent scissors structures */
typedef struct _Kink Kink;
@ -708,8 +702,6 @@ iscissors_draw_CR (GDisplay *gdisp,
int *indices,
int draw_type)
{
#define ROUND(x) ((int) ((x) + 0.5))
static GdkPoint gdk_points[256];
static int npoints = 256;
@ -1359,7 +1351,7 @@ shape_of_boundary (Tool *tool)
normalize (vec2);
/* determine the kinkiness based on the two vectors */
kinks[i].kinkiness = (M_PI - acos (dotprod (vec1, vec2)))/ M_PI;
kinks[i].kinkiness = (G_PI - acos (dotprod (vec1, vec2)))/ G_PI;
kinks[i].normal[0] = (vec1[0] + vec2[0]) / 2.0;
kinks[i].normal[1] = (vec1[1] + vec2[1]) / 2.0;
@ -1552,7 +1544,7 @@ orient_boundary (Tool *tool)
found = 0;
angle = atan2 (pts[i].normal[1], pts[i].normal[0]);
dir = ((angle > -3 * M_PI_4) && (angle < M_PI_4)) ? 1 : -1;
dir = ((angle > -3 * G_PI_4) && (angle < G_PI_4)) ? 1 : -1;
while (j < LOCALIZE_RADIUS && !found)
{

View File

@ -22,10 +22,6 @@
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "actionarea.h"
#include "drawable.h"

View File

@ -34,10 +34,6 @@
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
/* index into trans_info array */
#define ANGLE 0
#define REAL_ANGLE 1
@ -45,7 +41,7 @@
#define CENTER_Y 3
#define EPSILON 0.018 /* ~ 1 degree */
#define FIFTEEN_DEG (M_PI / 12.0)
#define FIFTEEN_DEG (G_PI / 12.0)
/* variables local to this file */
static gdouble angle_val;
@ -224,7 +220,7 @@ rotate_info_update (Tool *tool)
transform_core = (TransformCore *) tool->private;
angle_val = (transform_core->trans_info[ANGLE] * 180.0) / M_PI;
angle_val = (transform_core->trans_info[ANGLE] * 180.0) / G_PI;
center_vals[0] = transform_core->cx;
center_vals[1] = transform_core->cy;
@ -248,7 +244,7 @@ rotate_angle_changed (GtkWidget *w,
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
value = GTK_ADJUSTMENT (w)->value * M_PI / 180.0;
value = GTK_ADJUSTMENT (w)->value * G_PI / 180.0;
if (value != transform_core->trans_info[ANGLE])
{
@ -327,19 +323,19 @@ rotate_tool_motion (Tool *tool,
angle = angle2 - angle1;
if (angle > M_PI || angle < -M_PI)
angle = angle2 - ((angle1 < 0) ? 2*M_PI + angle1 : angle1 - 2*M_PI);
if (angle > G_PI || angle < -G_PI)
angle = angle2 - ((angle1 < 0) ? 2*G_PI + angle1 : angle1 - 2*G_PI);
/* increment the transform tool's angle */
transform_core->trans_info[REAL_ANGLE] += angle;
/* limit the angle to between 0 and 360 degrees */
if (transform_core->trans_info[REAL_ANGLE] < - M_PI)
if (transform_core->trans_info[REAL_ANGLE] < - G_PI)
transform_core->trans_info[REAL_ANGLE] =
2 * M_PI - transform_core->trans_info[REAL_ANGLE];
else if (transform_core->trans_info[REAL_ANGLE] > M_PI)
2 * G_PI - transform_core->trans_info[REAL_ANGLE];
else if (transform_core->trans_info[REAL_ANGLE] > G_PI)
transform_core->trans_info[REAL_ANGLE] =
transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
transform_core->trans_info[REAL_ANGLE] - 2 * G_PI;
/* constrain the angle to 15-degree multiples if ctrl is held down */
if (transform_core->state & GDK_CONTROL_MASK)

View File

@ -33,8 +33,6 @@
#include "tools.h"
#include "gimage.h"
#define ROUND(x) (int)((x) + .5)
#include "libgimp/gimpintl.h"

View File

@ -35,10 +35,6 @@
#include "tile.h" /* ick. */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define SUBSAMPLE 8
#define DIST_SMOOTHER_BUFFER 10
@ -775,8 +771,8 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
both as affine transforms would make the most sense. -RLL */
tscale = ink_options->tilt_sensitivity * 10.0;
tscale_c = tscale * cos (ink_options->tilt_angle * M_PI / 180);
tscale_s = tscale * sin (ink_options->tilt_angle * M_PI / 180);
tscale_c = tscale * cos (ink_options->tilt_angle * G_PI / 180);
tscale_s = tscale * sin (ink_options->tilt_angle * G_PI / 180);
x = ink_options->aspect*cos(ink_options->angle) +
xtilt * tscale_c - ytilt * tscale_s;
y = ink_options->aspect*sin(ink_options->angle) +

View File

@ -20,9 +20,10 @@
* thanks to Professor D. Forsyth for prompting us to implement this tool
*/
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "draw_core.h"
#include "channel_pvt.h"
@ -42,13 +43,6 @@
#include "libgimp/gimpintl.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#ifndef M_PI_4
#define M_PI_4 0.78539816339744830962
#endif /* M_PI_4 */
/* the intelligent scissors structures */
typedef struct _Kink Kink;
@ -708,8 +702,6 @@ iscissors_draw_CR (GDisplay *gdisp,
int *indices,
int draw_type)
{
#define ROUND(x) ((int) ((x) + 0.5))
static GdkPoint gdk_points[256];
static int npoints = 256;
@ -1359,7 +1351,7 @@ shape_of_boundary (Tool *tool)
normalize (vec2);
/* determine the kinkiness based on the two vectors */
kinks[i].kinkiness = (M_PI - acos (dotprod (vec1, vec2)))/ M_PI;
kinks[i].kinkiness = (G_PI - acos (dotprod (vec1, vec2)))/ G_PI;
kinks[i].normal[0] = (vec1[0] + vec2[0]) / 2.0;
kinks[i].normal[1] = (vec1[1] + vec2[1]) / 2.0;
@ -1552,7 +1544,7 @@ orient_boundary (Tool *tool)
found = 0;
angle = atan2 (pts[i].normal[1], pts[i].normal[0]);
dir = ((angle > -3 * M_PI_4) && (angle < M_PI_4)) ? 1 : -1;
dir = ((angle > -3 * G_PI_4) && (angle < G_PI_4)) ? 1 : -1;
while (j < LOCALIZE_RADIUS && !found)
{

View File

@ -22,10 +22,6 @@
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "actionarea.h"
#include "drawable.h"

View File

@ -34,10 +34,6 @@
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
/* index into trans_info array */
#define ANGLE 0
#define REAL_ANGLE 1
@ -45,7 +41,7 @@
#define CENTER_Y 3
#define EPSILON 0.018 /* ~ 1 degree */
#define FIFTEEN_DEG (M_PI / 12.0)
#define FIFTEEN_DEG (G_PI / 12.0)
/* variables local to this file */
static gdouble angle_val;
@ -224,7 +220,7 @@ rotate_info_update (Tool *tool)
transform_core = (TransformCore *) tool->private;
angle_val = (transform_core->trans_info[ANGLE] * 180.0) / M_PI;
angle_val = (transform_core->trans_info[ANGLE] * 180.0) / G_PI;
center_vals[0] = transform_core->cx;
center_vals[1] = transform_core->cy;
@ -248,7 +244,7 @@ rotate_angle_changed (GtkWidget *w,
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
value = GTK_ADJUSTMENT (w)->value * M_PI / 180.0;
value = GTK_ADJUSTMENT (w)->value * G_PI / 180.0;
if (value != transform_core->trans_info[ANGLE])
{
@ -327,19 +323,19 @@ rotate_tool_motion (Tool *tool,
angle = angle2 - angle1;
if (angle > M_PI || angle < -M_PI)
angle = angle2 - ((angle1 < 0) ? 2*M_PI + angle1 : angle1 - 2*M_PI);
if (angle > G_PI || angle < -G_PI)
angle = angle2 - ((angle1 < 0) ? 2*G_PI + angle1 : angle1 - 2*G_PI);
/* increment the transform tool's angle */
transform_core->trans_info[REAL_ANGLE] += angle;
/* limit the angle to between 0 and 360 degrees */
if (transform_core->trans_info[REAL_ANGLE] < - M_PI)
if (transform_core->trans_info[REAL_ANGLE] < - G_PI)
transform_core->trans_info[REAL_ANGLE] =
2 * M_PI - transform_core->trans_info[REAL_ANGLE];
else if (transform_core->trans_info[REAL_ANGLE] > M_PI)
2 * G_PI - transform_core->trans_info[REAL_ANGLE];
else if (transform_core->trans_info[REAL_ANGLE] > G_PI)
transform_core->trans_info[REAL_ANGLE] =
transform_core->trans_info[REAL_ANGLE] - 2 * M_PI;
transform_core->trans_info[REAL_ANGLE] - 2 * G_PI;
/* constrain the angle to 15-degree multiples if ctrl is held down */
if (transform_core->state & GDK_CONTROL_MASK)

View File

@ -33,8 +33,6 @@
#include "tools.h"
#include "gimage.h"
#define ROUND(x) (int)((x) + .5)
#include "libgimp/gimpintl.h"

View File

@ -42,12 +42,6 @@
#include "libgimp/gimpintl.h"
#define SQR(x) ((x) * (x))
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \
((1-dy) * (jk + dx * (j1k - jk)) + \
dy * (jk1 + dx * (j1k1 - jk1)))
@ -1414,8 +1408,8 @@ transform_core_do (GImage *gimage,
}
else /* no interpolation */
{
itx = rint(ttx);
ity = rint(tty);
itx = RINT(ttx);
ity = RINT(tty);
if (itx >= x1 && itx < x2 &&
ity >= y1 && ity < y2 )

View File

@ -42,12 +42,6 @@
#include "libgimp/gimpintl.h"
#define SQR(x) ((x) * (x))
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \
((1-dy) * (jk + dx * (j1k - jk)) + \
dy * (jk1 + dx * (j1k1 - jk1)))
@ -1414,8 +1408,8 @@ transform_core_do (GImage *gimage,
}
else /* no interpolation */
{
itx = rint(ttx);
ity = rint(tty);
itx = RINT(ttx);
ity = RINT(tty);
if (itx >= x1 && itx < x2 &&
ity >= y1 && ity < y2 )

View File

@ -172,10 +172,6 @@
/***** Magic numbers *****/
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
#define EPSILON 1e-10
@ -5945,7 +5941,7 @@ calc_sine_factor(double middle, double pos)
{
pos = calc_linear_factor(middle, pos);
return (sin((-M_PI / 2.0) + M_PI * pos) + 1.0) / 2.0;
return (sin((-G_PI / 2.0) + G_PI * pos) + 1.0) / 2.0;
} /* calc_sine_factor */

View File

@ -5,9 +5,9 @@
# Locale directory.
LOCALEDIR = c:\gimp\locale
# Only the fr file seems to be OK
# Only some languages actually have any translations
# LANGUAGES= de fi fr hu it ja ko nl pl ru sv
LANGUAGES= fr
LANGUAGES= fr ja no sv
################################################################