8 |
|
|
9 |
#include "gprint.h" |
#include "gprint.h" |
10 |
|
|
|
#ifdef NEED_DECLARATION_HYPOT |
|
|
extern "C" { |
|
|
double hypot(double, double); |
|
|
} |
|
|
#endif /* NEED_DECLARATION_HYPOT */ |
|
|
|
|
11 |
#define MAXVECT 40 |
#define MAXVECT 40 |
12 |
#define MAXPOINTS 200 |
#define MAXPOINTS 200 |
13 |
#define LINELENGTH 1 |
#define LINELENGTH 1 |
14 |
#define PointsPerInterval 64 |
#define PointsPerInterval 64 |
15 |
#define pi 3.14159265358979324 |
#define pi 3.14159265358979324 |
16 |
#define twopi (2.0 * pi) |
#define twopi (2.0 * pi) |
17 |
#define len(a, b) hypot((double)(b.x-a.x), (double)(b.y-a.y)) |
#define len(a, b) groff_hypot((double)(b.x-a.x), (double)(b.y-a.y)) |
18 |
|
|
19 |
|
|
20 |
extern int dotshifter; /* for the length of dotted curves */ |
extern int dotshifter; /* for the length of dotted curves */ |
594 |
|
|
595 |
length = 0; |
length = 0; |
596 |
|
|
597 |
resolution = (1.0 + hypot(xs, ys) / res) * PointsPerInterval; |
resolution = (1.0 + groff_hypot(xs, ys) / res) * PointsPerInterval; |
598 |
/* mask = (1 << (int) log10(resolution + 1.0)) - 1; */ |
/* mask = (1 << (int) log10(resolution + 1.0)) - 1; */ |
599 |
(void) frexp(resolution, &m); /* A bit more elegant than log10 */ |
(void) frexp(resolution, &m); /* A bit more elegant than log10 */ |
600 |
for (mask = 1; mask < m; mask = mask << 1); |
for (mask = 1; mask < m; mask = mask << 1); |
665 |
for (; npts--; x++, y++) { /* traverse the line segments */ |
for (; npts--; x++, y++) { /* traverse the line segments */ |
666 |
xp = x[0] - x[1]; |
xp = x[0] - x[1]; |
667 |
yp = y[0] - y[1]; |
yp = y[0] - y[1]; |
668 |
nseg = (int) hypot((double) xp, (double) yp); |
nseg = (int) groff_hypot((double) xp, (double) yp); |
669 |
xp = x[1] - x[2]; |
xp = x[1] - x[2]; |
670 |
yp = y[1] - y[2]; |
yp = y[1] - y[2]; |
671 |
/* `nseg' is the number of line */ |
/* `nseg' is the number of line */ |
672 |
/* segments that will be drawn for */ |
/* segments that will be drawn for */ |
673 |
/* each curve segment. */ |
/* each curve segment. */ |
674 |
nseg = (int) ((double) (nseg + (int) hypot((double) xp, (double) yp)) / |
nseg = (int) ((double) (nseg + (int) groff_hypot((double) xp, (double) yp)) / |
675 |
res * PointsPerInterval); |
res * PointsPerInterval); |
676 |
|
|
677 |
for (i = 1; i < nseg; i++) { |
for (i = 1; i < nseg; i++) { |
789 |
dy = y[j + 1] - y[j]; |
dy = y[j + 1] - y[j]; |
790 |
/* Here was overflowing, so I changed it. */ |
/* Here was overflowing, so I changed it. */ |
791 |
/* u[i] += sqrt ((double) (dx * dx + dy * dy)); */ |
/* u[i] += sqrt ((double) (dx * dx + dy * dy)); */ |
792 |
u[i] += hypot((double) dx, (double) dy); |
u[i] += groff_hypot((double) dx, (double) dy); |
793 |
} |
} |
794 |
} |
} |
795 |
for (i = 1; i < n; ++i) |
for (i = 1; i < n; ++i) |