ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgf2meta.c
(Generate patch)

Comparing ray/src/cv/mgf2meta.c (file contents):
Revision 2.4 by greg, Thu May 4 13:55:30 1995 UTC vs.
Revision 2.5 by greg, Thu May 4 14:25:15 1995 UTC

# Line 13 | Line 13 | static char SCCSid[] = "$SunId$ LBL";
13   #include "random.h"
14   #include "mgflib/parser.h"
15  
16 < #define MX(v)   (int)(((1<<14)-1)*(v)[(proj_axis+1)%3])
17 < #define MY(v)   (int)(((1<<14)-1)*(v)[(proj_axis+2)%3])
16 > #define MSIZE   ((1<<14)-1)
17 > #define MX(v)   (int)(MSIZE*(v)[(proj_axis+1)%3])
18 > #define MY(v)   (int)(MSIZE*(v)[(proj_axis+2)%3])
19  
20 + #ifdef  DCL_ATOF
21 + extern double  atof();
22 + #endif
23 +
24   int     r_face();
25   int     proj_axis;
26   double  limit[3][2];
27   int     layer;
28 + long    rthresh = 1;
29  
30   extern int      mg_nqcdivs;
31  
# Line 37 | Line 43 | char   *argv[];
43          mg_nqcdivs = 3;         /* reduce object subdivision */
44          mg_init();              /* initialize the parser */
45                                          /* get arguments */
46 +        if (argc > 9 && !strcmp(argv[1], "-t")) {
47 +                rthresh = atof(argv[2])*MSIZE + 0.5;
48 +                rthresh *= rthresh;
49 +                argv += 2;
50 +                argc -= 2;
51 +        }
52          if (argc < 8 || (proj_axis = argv[1][0]-'x') < 0 || proj_axis > 2)
53                  goto userr;
54          limit[0][0] = atof(argv[2]); limit[0][1] = atof(argv[3]);
# Line 56 | Line 68 | char   *argv[];
68          mdone();                        /* close output */
69          exit(0);
70   userr:
71 <        fprintf(stderr, "Usage: %s {x|y|z} xmin xmax ymin ymax zmin zmax [file.mgf] ..\n",
72 <                        argv[0]);
71 >        fputs("Usage: mgf2meta [-t thresh] {x|y|z} xmin xmax ymin ymax zmin zmax [file.mgf] ..\n",
72 >                        stderr);
73          exit(1);
74   }
75  
# Line 102 | Line 114 | short  hshtab[HTBLSIZ][4];             /* done line segments */
114   #define  hash(mx1,my1,mx2,my2)  ((long)(mx1)<<15 ^ (long)(my1)<<10 ^ \
115                                          (long)(mx2)<<5 ^ (long)(my2))
116  
105 #define  RANDMASK       ((1L<<14)-1)
117  
107
118   newlayer()                              /* start a new layer */
119   {
120   #ifdef BSD
# Line 136 | Line 146 | int    v1x, v1y, v2x, v2y;
146          hshtab[h][0] = v1x; hshtab[h][1] = v1y;
147          hshtab[h][2] = v2x; hshtab[h][3] = v2y;
148          if ((long)(v2x-v1x)*(v2x-v1x) + (long)(v2y-v1y)*(v2y-v1y)
149 <                        <= (random()&RANDMASK))
149 >                        <= random() % rthresh)
150                  return(0);
151          mline(v1x, v1y, layer/4, 0, layer%4);
152          mdraw(v2x, v2y);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines