summaryrefslogtreecommitdiff
path: root/ipl/gprogs/design3.icn
blob: 3e31dbc6a419b59497e65b50e4b7fe65e5374ae1 (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
############################################################################
#
#	File:     design3.icn
#
#	Subject:  Program to draw square design
#
#	Author:   Ralph E. Griswold
#
#	Date:     February 17, 1995
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  This program draws a design in which i points around a square are
#  all connected to each other.  The number of points along a side
#  (default 10) and the distance between them (default 40) are given as
#  command-line arguments.
#
############################################################################
#
#  Requires:  Version 9 graphics
#
############################################################################
#
#   Links: gobject, joinpair, wopen
#
############################################################################

link gobject
link joinpair
link wopen

procedure main(argl)
   local i, j, k, d, extent, points, x, y

   i := integer(argl[1]) | 10
   d := integer(argl[2]) | 40

   extent := i * d

   WOpen("label=mandala", "width=" || extent, "height=" || extent) |
      stop("*** cannot open window")

   points := []

   every x := 0 to extent by d do {	# x direction, with corners
      put(points, Point(x, 0))		# top
      put(points, Point(x, extent))	# bottom
      }

   every y := d to extent - d by d do {	# y direction, without corners
      put(points, Point(0, y))		# left side
      put(points, Point(extent, y))	# right side
      }

   joinpair(points, points)

   Event()

end