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