summaryrefslogtreecommitdiff
path: root/ipl/gprocs/modlines.icn
blob: 6fe2151fd4c19c4d345ba4021aff282cd2ded1c8 (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
############################################################################
#
#	File:     modlines.icn
#
#	Subject:  Procedure to produce trace of modular lines
#
#	Author:   Ralph E. Griswold
#
#	Date:     August 3, 2000
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  For a description of the method used here, see
#
#	Geometric and Artistic Graphics; Design Generation with
#	Microcomputers, Jean-Paul Delahaye, Macmillan, 1987, pp. 90-95.
#	
############################################################################
#
#  Links:  calls, gobject, gtrace
#
############################################################################

link calls
link gobject
link gtrace

#  modlines produces a trace of lines between points selected modulo n,
#  where n is the number of points on a supporting curve.  k is an
#  offset factor.  A trace of the supporting curve is produced by call.
#
procedure modlines(call, m, k, limit)
   local points, n, i

   /limit := 500			# maximum number of points allowed

   points := point_list(call, limit)

   n := *points				# number of points on supporting curve

   every i := 0 to m do {
#     i1 := i % n + 1
#     i2 := (i * k) % n + 1
      suspend points[(i % n + 1) | ((i * k) % n + 1)]
      }

end