home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume3 / chaos / patch1 < prev    next >
Encoding:
Text File  |  1989-03-10  |  9.1 KB  |  387 lines

  1. Path: uunet!ncrlnk!ncrcae!hubcap!gatech!bloom-beacon!apple!vsi1!wyse!mikew
  2. From: mikew@wyse.wyse.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v03i048:  The Chaos Game, Patch1
  5. Message-ID: <2128@wyse.wyse.com>
  6. Date: 10 Mar 89 19:54:54 GMT
  7. Organization: Wyse Technology, San Jose
  8. Lines: 376
  9. Approved: mikew@wyse.com
  10.  
  11. Submitted-by: Nathan K. Meyers <nathanm%hpcvxnkm@hp-sde.sde.hp.com>
  12. Posting-number: Volume 3, Issue 48
  13. Archive-name: chaos/patch1
  14.  
  15.  
  16.  
  17. These patches to chaos add a feature and clean up the program slightly.
  18. The README file now reflects the the behavior of the boilerplate
  19. makefile added by the moderator to my previous posting.
  20.  
  21. Nathan Meyers
  22. nathanm@hp-pcd.hp.com
  23.  
  24. ============================================================================
  25.  
  26. *** orig-README    Tue Mar  7 09:24:49 1989
  27. --- README    Tue Mar  7 09:24:29 1989
  28. ***************
  29. *** 8,14
  30.   
  31.   To make on systems of SYSV descent (such as hp-ux):
  32.   
  33. !     make SYSV
  34.   
  35.   ---------------------
  36.   Nathan Meyers
  37.  
  38. --- 8,14 -----
  39.   
  40.   To make on systems of SYSV descent (such as hp-ux):
  41.   
  42. !     make "CDEBUGFLAGS=-O -DSYSV"
  43.   
  44.   ---------------------
  45.   Nathan Meyers
  46.  
  47.  
  48.  
  49.  
  50.  
  51. *** orig-chaos.1    Tue Mar  7 09:24:50 1989
  52. --- chaos.1    Tue Mar  7 09:24:29 1989
  53. ***************
  54. *** 8,13
  55.   \fBchaos\fR
  56.   [\|\fB-bd\fR border\|] [\|\fB-bg\fR background\|] [\|\fB-bw\fR borderwidth\|]
  57.   [\|\fB-delay\fR msec\|] [\|\fB-display\fR displayname\|]
  58.   [\|\fB-geometry\fR geometry\|]
  59.   [\|\fB-mpoints\fR\|]
  60.   [\|\fB-out\fR bitmapfile\|]
  61.  
  62. --- 8,14 -----
  63.   \fBchaos\fR
  64.   [\|\fB-bd\fR border\|] [\|\fB-bg\fR background\|] [\|\fB-bw\fR borderwidth\|]
  65.   [\|\fB-delay\fR msec\|] [\|\fB-display\fR displayname\|]
  66. + [\|\fB-dist\fR distance\|]
  67.   [\|\fB-geometry\fR geometry\|]
  68.   [\|\fB-mpoints\fR\|]
  69.   [\|\fB-out\fR bitmapfile\|]
  70. ***************
  71. *** 74,79
  72.   Specify display on which to run; defaults to contents of DISPLAY
  73.   environment variable.
  74.   .TP
  75.   .B -geometry
  76.   Specify window geometry; defaults to =300x300+0+0.
  77.   .TP
  78.  
  79. --- 75,86 -----
  80.   Specify display on which to run; defaults to contents of DISPLAY
  81.   environment variable.
  82.   .TP
  83. + .B -dist
  84. + Allows you to specify the distance moved for each point.  Default value
  85. + is 0.5.  When this option is used, point P\v'+.2v'\s-2n\v'-.2v'\s0 will
  86. + be located the specified fraction of the distance between
  87. + P\v'+.2v'\s-2n-1\v'-.2v'\s0 and the selected vertex.
  88. + .TP
  89.   .B -geometry
  90.   Specify window geometry; defaults to =300x300+0+0.
  91.   .TP
  92. ***************
  93. *** 138,141
  94.   chaos -points 0,0,.3,1,.7,1,1,0
  95.   .SH AUTHORSHIP
  96.   \fIChaos\fR was authored by Nathan Meyers of Hewlett-Packard
  97. ! (nathanm@hp-pcd).
  98.  
  99. --- 145,150 -----
  100.   chaos -points 0,0,.3,1,.7,1,1,0
  101.   .SH AUTHORSHIP
  102.   \fIChaos\fR was authored by Nathan Meyers of Hewlett-Packard
  103. ! (nathanm@hp-pcd).  Thanks to Paul T. Keener of the University
  104. ! of Pennsylvania (keener@upenn5.hpe.upenn.edu) for the -dist
  105. ! option.
  106.  
  107.  
  108.  
  109.  
  110.  
  111. *** orig-chaos.c    Tue Mar  7 09:24:53 1989
  112. --- chaos.c    Tue Mar  7 09:24:29 1989
  113. ***************
  114. *** 20,26
  115.   
  116.   char *progname;
  117.   
  118. ! static char *what = "@(#)chaos.c $Revision: 1.13 $";
  119.   
  120.   struct dattract {
  121.     double x,y;
  122.  
  123. --- 20,26 -----
  124.   
  125.   char *progname;
  126.   
  127. ! static char *what = "@(#)chaos.c $Revision: 1.17 $";
  128.   
  129.   struct dattract {
  130.     double x,y;
  131. ***************
  132. *** 29,35
  133.            { 0.5, 0.846410161513 } };
  134.   
  135.   struct dattract *fpoints = dpoints;
  136. - int npoints = 3;
  137.   char *strchr();
  138.   
  139.   main(argc,argv)
  140.   int argc;
  141.  
  142. --- 29,34 -----
  143.            { 0.5, 0.846410161513 } };
  144.   
  145.   struct dattract *fpoints = dpoints;
  146.   
  147.   main(argc,argv)
  148.   int argc;
  149. ***************
  150. *** 49,55
  151.     char *foreground = NULL, *background = NULL, *border = NULL;
  152.     char *geomstring = NULL;
  153.     XColor visual_def_return, exact_def_return;
  154. -   XEvent event;
  155.     int o_argc = argc;
  156.     char **o_argv = argv;
  157.     int i,j;
  158.  
  159. --- 48,53 -----
  160.     char *foreground = NULL, *background = NULL, *border = NULL;
  161.     char *geomstring = NULL;
  162.     XColor visual_def_return, exact_def_return;
  163.     int o_argc = argc;
  164.     char **o_argv = argv;
  165.     int i;
  166. ***************
  167. *** 52,58
  168.     XEvent event;
  169.     int o_argc = argc;
  170.     char **o_argv = argv;
  171. !   int i,j;
  172.     char *basename;
  173.     int width, height;
  174.     int mapped=0;
  175.  
  176. --- 50,56 -----
  177.     XColor visual_def_return, exact_def_return;
  178.     int o_argc = argc;
  179.     char **o_argv = argv;
  180. !   int i;
  181.     char *basename;
  182.     int width, height;
  183.     int mapped=0;
  184. ***************
  185. *** 63,69
  186.     char *bitmapfilename = "chaos.xbm";
  187.     char *pointlist = NULL;
  188.     int manpoints = 0;
  189. !   double time();
  190.   
  191.     progname = argv[0];
  192.   
  193.  
  194. --- 61,70 -----
  195.     char *bitmapfilename = "chaos.xbm";
  196.     char *pointlist = NULL;
  197.     int manpoints = 0;
  198. !   int npoints = 3;
  199. !   double mulcon = 0.5;
  200. !   long time(), atol();
  201. !   char *strrchr();
  202.   
  203.     progname = argv[0];
  204.   
  205. ***************
  206. *** 71,77
  207.     else basename=progname;
  208.   
  209.     while (--argc>0) {
  210. !     char *option = (*++argv);
  211.       if (!strcmp(option,"-delay")) {
  212.         if (--argc==0) usage();
  213.         delayvalue = atol(*++argv);
  214.  
  215. --- 72,78 -----
  216.     else basename=progname;
  217.   
  218.     while (--argc>0) {
  219. !     char *option = (*++argv), *strchr();
  220.       if (!strcmp(option,"-delay")) {
  221.         if (--argc==0) usage();
  222.         delayvalue = atol(*++argv);
  223. ***************
  224. *** 106,111
  225.         bwidth = atoi(*++argv);
  226.         if (bwidth<0) bwidth = 0;
  227.       }
  228.       else if (!strcmp(option,"-geometry")) {
  229.         if (--argc==0) usage();
  230.         geomstring = (*++argv);
  231.  
  232. --- 107,118 -----
  233.         bwidth = atoi(*++argv);
  234.         if (bwidth<0) bwidth = 0;
  235.       }
  236. +     else if (!strcmp(option,"-dist")) {
  237. +       double atof();
  238. +       if (--argc==0) usage();
  239. +       mulcon = atof(*++argv);
  240. +       if (mulcon < 0.0) mulcon = -mulcon;
  241. +     }
  242.       else if (!strcmp(option,"-geometry")) {
  243.         if (--argc==0) usage();
  244.         geomstring = (*++argv);
  245. ***************
  246. *** 132,138
  247.       char *calloc(), *strchr();
  248.       double strtod();
  249.       int commacount = 0;
  250. -     int len;
  251.       while (*temp != '\0') commacount += (*(temp++) == ',') ? 1 : 0;
  252.       if (!(commacount & 0x1)) usage();
  253.       npoints = (commacount >> 1) + 1;
  254.  
  255. --- 139,144 -----
  256.       char *calloc(), *strchr();
  257.       double strtod();
  258.       int commacount = 0;
  259.       while (*temp != '\0') commacount += (*(temp++) == ',') ? 1 : 0;
  260.       if (!(commacount & 0x1)) usage();
  261.       npoints = (commacount >> 1) + 1;
  262. ***************
  263. *** 337,343
  264.         int fd = ConnectionNumber(display);
  265.         int readfds = 1<<fd;
  266.         long delay = mapped ? delayvalue : udelayvalue;
  267. !           getnextpoint(&x, &y, &ix, &iy, width, height);
  268.             XFillRectangle(display, win, wingc, ix, iy, 1, 1);
  269.             XFillRectangle(display, bitmap, bitmapgc2, ix, iy, 1, 1);
  270.         if (mapped) XFlush(display);
  271.  
  272. --- 343,349 -----
  273.         int fd = ConnectionNumber(display);
  274.         int readfds = 1<<fd;
  275.         long delay = mapped ? delayvalue : udelayvalue;
  276. !           getnextpoint(&x, &y, &ix, &iy, width, height, npoints, mulcon);
  277.             XFillRectangle(display, win, wingc, ix, iy, 1, 1);
  278.             XFillRectangle(display, bitmap, bitmapgc2, ix, iy, 1, 1);
  279.         if (mapped) XFlush(display);
  280. ***************
  281. *** 348,354
  282.           else {
  283.         XRectangle rects[DOTSPERCALL];
  284.         for (i=0; i<DOTSPERCALL; i++) {
  285. !             getnextpoint(&x, &y, &ix, &iy, width, height);
  286.           rects[i].x = ix;
  287.           rects[i].y = iy;
  288.           rects[i].width = 1;
  289.  
  290. --- 354,360 -----
  291.           else {
  292.         XRectangle rects[DOTSPERCALL];
  293.         for (i=0; i<DOTSPERCALL; i++) {
  294. !             getnextpoint(&x, &y, &ix, &iy, width, height, npoints, mulcon);
  295.           rects[i].x = ix;
  296.           rects[i].y = iy;
  297.           rects[i].width = 1;
  298. ***************
  299. *** 409,415
  300.     }
  301.   }
  302.   
  303. ! getnextpoint(x, y, ix, iy, width, height)
  304.   double *x, *y;
  305.   int *ix, *iy;
  306.   int width, height;
  307.  
  308. --- 415,421 -----
  309.     }
  310.   }
  311.   
  312. ! getnextpoint(x, y, ix, iy, width, height, npoints, mulcon)
  313.   double *x, *y;
  314.   int *ix, *iy;
  315.   int width, height;
  316. ***************
  317. *** 413,418
  318.   double *x, *y;
  319.   int *ix, *iy;
  320.   int width, height;
  321.   {
  322.     long rndm();
  323.     int dest;
  324.  
  325. --- 419,426 -----
  326.   double *x, *y;
  327.   int *ix, *iy;
  328.   int width, height;
  329. + int npoints;
  330. + double mulcon;
  331.   {
  332.     long rndm();
  333.     int dest;
  334. ***************
  335. *** 417,424
  336.     long rndm();
  337.     int dest;
  338.     dest = (int)rndm((long)npoints);
  339. !   *x = (fpoints[dest].x + *x)/2.0;
  340. !   *y = (fpoints[dest].y + *y)/2.0;
  341.     *ix = (int)(*x * width + .5);
  342.     *iy = (int)(*y * height + .5);
  343.   }
  344.  
  345. --- 425,432 -----
  346.     long rndm();
  347.     int dest;
  348.     dest = (int)rndm((long)npoints);
  349. !   *x = (fpoints[dest].x - *x) * mulcon + *x;
  350. !   *y = (fpoints[dest].y - *y) * mulcon + *y;
  351.     *ix = (int)(*x * width + .5);
  352.     *iy = (int)(*y * height + .5);
  353.   }
  354. ***************
  355. *** 432,437
  356.       "[-bw <borderwidth>]",
  357.       "[-delay <msec>]",
  358.       "[-display <displayname>]",
  359.       "[-geometry <geometry>]",
  360.       "[-mpoints]",
  361.       "[-out <bitmapfile>]",
  362.  
  363. --- 440,446 -----
  364.       "[-bw <borderwidth>]",
  365.       "[-delay <msec>]",
  366.       "[-display <displayname>]",
  367. +     "[-dist <distance>]",
  368.       "[-geometry <geometry>]",
  369.       "[-mpoints]",
  370.       "[-out <bitmapfile>]",
  371.  
  372.  
  373.  
  374.  
  375.  
  376. *** orig-patchlevel.h    Tue Mar  7 09:24:55 1989
  377. --- patchlevel.h    Tue Mar  7 09:24:30 1989
  378. ***************
  379. *** 1
  380. ! #define PATCHLEVEL 0
  381.  
  382. --- 1 -----
  383. ! #define PATCHLEVEL 1
  384. -- 
  385. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  386. Moderator of comp.sources.x
  387.