summaryrefslogtreecommitdiff
path: root/ipl/gprocs/spokes.icn
blob: 853de2db70ecb15f2c7b767ee0aa2cb9422a1f02 (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
############################################################################
#
#	File:     spokes.icn
#
#	Subject:  Procedure to draw spokes
#
#	Author:   Ralph E. Griswold
#
#	Date:     May 2, 2001
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  spokes(x, y, radius1, radius2, n, m) draws spokes.
#
############################################################################
#
#  Links:  gobject
#
############################################################################

link gobject

procedure spokes(x, y, radius1, radius2, n, m)
   local angle1, incr1, angle2, incr2

   angle1 := 0.0
   incr1 := 2 * &pi / n

   every 1 to n do {
      suspend rays(x + radius1 * cos(angle1), y + radius1 * sin(angle1),
         radius2, m, angle1)
      angle1 +:= incr1
      }

end

procedure rays(xc, yc, r, m, angle)
   local incr

   incr := 2 * &pi / m 

   every 1 to m do {
      suspend Point(xc, yc)
      suspend Point(xc + r * cos(angle), yc + r * sin(angle))
      suspend Point(xc, yc)
      angle +:= incr
      }

end