/[groff]/groff/src/preproc/grn/hgraph.cpp
ViewVC logotype

Diff of /groff/src/preproc/grn/hgraph.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by wlemb, Sat Apr 17 06:41:49 2004 UTC revision 1.4 by wl, Thu Mar 17 08:29:15 2005 UTC
# Line 8  Line 8 
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 */
# Line 600  HGArc(register int cx, Line 594  HGArc(register int cx,
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);
# Line 671  picurve(register int *x, Line 665  picurve(register int *x,
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++) {
# Line 795  Paramaterize(int x[], Line 789  Paramaterize(int x[],
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)

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26