home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / SC-TS25B.LZX / Typesmith / Rexx / ReducePoints.tsrx < prev   
Encoding:
Text File  |  1993-11-09  |  1.7 KB  |  91 lines

  1. /* REDUCE POINTS - REMOVE CO-LOCATED POINTS */
  2. /* Copyright 1993 Soft-Logik Publishing Corporation */
  3. /* May not be distributed without Soft-Logik Publishing Corporation's express written permission */
  4. /* $VER: 2.0 */
  5.  
  6. ADDRESS 'TYPESMITH'
  7. OPTIONS RESULTS
  8. TRACE OFF
  9.  
  10. /* Screen to front */
  11.  
  12. to_front
  13. delcount=0
  14.  
  15. /* this is the start of the main program. Restart to here after deleting a point */
  16.  
  17. Restart:
  18.  
  19. /* find the number of character paths and store it */
  20. get_numpaths
  21. numpaths=RESULT
  22.  
  23. /* select first path and get coordinates of first point */
  24. first_path
  25. get_pointx
  26. pointx1=RESULT
  27. get_pointy
  28. pointy1=RESULT
  29. get_prev_bcpx
  30. pbcpx1=RESULT
  31. get_prev_bcpy
  32. pbcpy1=RESULT
  33. get_next_bcpx
  34. nbcpx1=RESULT
  35. get_next_bcpy
  36. nbcpy1=RESULT
  37.  
  38. /* Loop for number of paths */
  39. DO i=numpaths TO 1 BY -1
  40.  
  41.     /* find the number of points and store it */
  42.     get_numpoints
  43.     numpoints=RESULT
  44.  
  45.     /* Loop for number of points */
  46.     DO ii=numpoints TO 2 BY -1
  47.  
  48.         next_point
  49.  
  50.         /* get coordinates of point */
  51.         get_pointx
  52.         pointx2=RESULT
  53.         get_pointy
  54.         pointy2=RESULT
  55.         get_prev_bcpx
  56.         pbcpx2=RESULT
  57.         get_prev_bcpy
  58.         pbcpy2=RESULT
  59.         get_next_bcpx
  60.         nbcpx2=RESULT
  61.         get_next_bcpy
  62.         nbcpy2=RESULT
  63.  
  64.         /* compares the coordinates of the current and previous points */
  65.         IF (pointx1=pointx2 & pointy1=pointy2) THEN DO
  66.             /* delete if equal */
  67.             delete
  68.             delcount=delcount+1
  69.             SIGNAL restart
  70.         END
  71.         IF (pointx1~=pointx2 | pointy1~=pointy2) THEN DO
  72.             /* else store the current points in x1,y1 */
  73.             pointx1=pointx2
  74.             pointy1=pointy2
  75.             pbcpx1=pbcpx2
  76.             pbcpy1=pbcpy2
  77.             nbcpx1=nbcpx2
  78.             nbcpy1=nbcpy2
  79.         END
  80.  
  81.     END
  82.  
  83.     /* select the next path */
  84.     next_path
  85.  
  86. END
  87.  
  88. display_alert ' 'delcount' co-located points deleted!|Exit'
  89.  
  90. /* THAT'S ALL FOLKS */
  91.