home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gprocs / xgtrace.icn < prev    next >
Text File  |  2000-07-29  |  2KB  |  82 lines

  1. ############################################################################
  2. #
  3. #    File:     xgtrace.icn
  4. #
  5. #    Subject:  Procedures to draw traces of points
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     November 19, 1997
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  As used here, the term "trace" refers to a sequence of points that
  18. #  generally consists of locations on a curve or other geometrical object.
  19. #
  20. ############################################################################
  21. #
  22. #  Requires:  Version 9 graphics
  23. #
  24. ############################################################################
  25. #
  26. #  Links:  gtace, turtle
  27. #
  28. ############################################################################
  29.  
  30. link gtrace
  31. link turtle
  32.  
  33. #
  34. #  line_trace(call) draws lines along the figure described by the trace from
  35. #  invoke(call).
  36.  
  37. procedure line_trace(call)
  38.    local TPlot, point
  39.  
  40.    TPlot := TGoto            # go to first point
  41.    every point := invoke(call) do {
  42.       TPlot(point.x, point.y)
  43.       TPlot := TDrawto            # draw subsequently
  44.       }
  45.  
  46.    return
  47.  
  48. end
  49.  
  50. #
  51. #  segment_trace(call) draws line segments between successive pairs of
  52. #  points along the figure described by the trace from invoke(call).
  53.  
  54. procedure segment_trace(call)
  55.    local TPlot, TPlotNext, point
  56.  
  57.    TPlot := TGoto            # go to first point
  58.    TPlotNext := TDrawto
  59.    every point := invoke(call) do {
  60.       TPlot(point.x, point.y)
  61.       TPlot :=: TPlotNext        # draw subsequently
  62.       }
  63.  
  64.    return
  65.  
  66. end
  67.  
  68. #
  69. #  curve_trace(call) draws a curve along the figure described by the trace
  70. #  from invoke(call).
  71. #
  72. procedure curve_trace(call, limit)
  73.    local points, n
  74.  
  75.    /limit := 500            # maximum number of points allowed
  76.  
  77.    DrawCurve ! coord_list(call, limit)
  78.  
  79.    return
  80.  
  81. end
  82.